cach-radio/inc/themes/castanet/layouts/partials/seo.html

67 lines
3.4 KiB
HTML
Raw Permalink Normal View History

2022-12-15 22:36:40 +01:00
<meta property="og:title" content="{{ title .Title }}" />
<meta name="twitter:title" content="{{ .Title }}"/>
<meta itemprop="name" content="{{ .Title }}">
<meta property="article:published_time" content="{{ dateFormat "2006-01-02T15:04:05Z07:00" .Date }}" />
<meta property="article:modified_time" content="{{ dateFormat "2006-01-02T15:04:05Z07:00" .Lastmod }}" />
<meta property="og:updated_time" content="{{ dateFormat "2006-01-02T15:04:05Z07:00" .Lastmod }}" />
{{- with .Site.Title -}}<meta property="og:site_name" content="{{ . }}" />{{- end -}}
{{- with .Params.locale -}}<meta property="og:locale" content="{{ . }}" />{{- end -}}
{{- if .IsHome -}}
{{ with .Site.Params.feed.itunes_summary -}}
<meta property="og:description" content="{{ . }}" />
<meta name="twitter:description" content="{{ . }}" />
<meta itemprop="description" content="{{ . }}" />
{{- else -}}
<meta property="og:description" content="{{ $.Site.Title }}" />
<meta name="twitter:description" content="{{ $.Site.Title }}" />
<meta itemprop="description" content="{{ $.Site.Title }}" />
{{- end -}}
{{- else -}}
<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}" />
<meta name="twitter:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}" />
<meta itemprop="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}">
{{- end -}}
<!--
The twitter link can be based in short ("arresteddevops") or
long form ("https://twitter.com/arresteddevops")
In long form we need to strip everything but the twitter handle
for the SEO tags
-->
{{ if (isset .Site.Params.social "twitter" )}}
{{ if gt (len (urls.Parse .Site.Params.social.twitter).Scheme) 0 }}
<meta name="twitter:site" content="@{{ trim ((urls.Parse .Site.Params.social.twitter).Path) "/" }}"/>
<meta name="twitter:creator" content="@{{ trim ((urls.Parse .Site.Params.social.twitter).Path) "/" }}"/>
{{ else }}
<meta name="twitter:site" content="@{{ .Site.Params.social.twitter }}"/>
<meta name="twitter:creator" content="@{{ .Site.Params.social.twitter }}"/>
{{ end }}
{{ end }}
{{ with .Site.Params.social.twitter_domain }}<meta name="twitter:domain" content="{{ . }}"/>{{ end }}
{{ if eq .Type "episode" }}
<meta property="og:type" content="article" />
{{- else if .Params.type -}}
<meta property="og:type" content="{{ .Params.type }}" />
{{- else -}}
<meta property="og:type" content="website" />
{{ end }}
<meta property="og:url" content="{{ .Permalink | relURL }}" />
{{ with .Params.images }}{{ range first 1 . }}
<meta name="twitter:card" content="summary_large_image" />
{{ if (eq (slicestr . 0 4) "http") }}
<meta property="og:image" content="{{ . }}"/>
<meta name="twitter:image" content="{{ . }}" />
<meta itemprop="image" content="{{ . }}" />
{{ else }}
<meta property="og:image" content="{{ $.Site.BaseURL}}/{{ . }}" />
<meta name="twitter:image" content="{{ $.Site.BaseURL}}/{{ . }}"/>
<meta itemprop="image" content="{{ $.Site.BaseURL}}/{{ . }}" />
{{ end }}
{{ end }}{{ end }}
<!-- Facebook Page Admin ID for Domain Insights -->
{{ with .Site.Params.social.facebook_admin }}
{{ range . }}
<meta property="fb:admins" content="{{ . }}" />
{{ end }}
{{ end }}