riq0h.jp/themes/qiss/layouts/partials/social/opengraph.html

81 lines
2.4 KiB
HTML
Raw Normal View History

2023-08-21 10:07:01 +09:00
<meta property='og:title' content='{{ partial "data/title" . }}'>
<meta property='og:description' content='{{ partial "data/description" . }}'>
<meta property='og:url' content='{{ .Permalink }}'>
<meta property='og:site_name' content='{{ .Site.Title }}'>
<meta property='og:type' content='
{{- if .IsPage -}}
article
{{- else -}}
website
{{- end -}}
'>
{{- with .Params.image -}}
<meta property='og:image' content='{{ . | absURL }}'>
{{- else -}}
{{- with .Site.Params.Social.email -}}
<meta property='og:image' content='https://www.gravatar.com/avatar/
{{- . | md5 -}}
?s=256'>
{{- end -}}
{{- with .Params.audios -}}
{{- range first 6 . -}}
<meta property='og:audio' content='{{ . | absURL }}'>
{{- end -}}
{{- end -}}
{{- with .Params.videos -}}
{{- range first 6 . -}}
<meta property='og:video' content='{{ . | absURL }}'>
{{- end -}}
{{- end -}}
{{- if .IsPage -}}
{{- with .Site.Params.Social.facebook -}}
<meta property='article:author' content='https://facebook.com/{{ . }}'>
{{- end -}}
{{- end -}}
{{- with .Site.Params.opengraph.facebook.pageid -}}
<meta property='article:publisher' content='{{ . }}'>
{{- end -}}
<meta property='article:section' content='{{- .Section | title -}}'>
{{- range .Params.tags -}}
<meta property='article:tag' content='{{ . }}'>
{{- end -}}
{{- end -}}
{{- $dateFormat := "2006-01-02T15:04:05Z07:00" -}}
{{- if .IsPage -}}
{{- if not .PublishDate.IsZero -}}
<meta property='article:published_time' content='{{ .PublishDate.Format $dateFormat }}'/>
{{- else if not .Date.IsZero -}}
<meta property='article:published_time' content='{{ .Date.Format $dateFormat }}'/>
{{- end -}}
{{- if not .Lastmod.IsZero -}}
<meta property='article:modified_time' content='{{ .Lastmod.Format $dateFormat }}'/>
{{- end -}}
{{- if not .ExpiryDate.IsZero -}}
<meta property='article:expiration_time' content='{{ .ExpiryDate.Format $dateFormat }}'/>
{{- end -}}
{{- else -}}
2024-10-09 18:01:56 +09:00
{{- if not .Site.LastChange.IsZero -}}
<meta property='og:updated_time' content='{{ .Site.LastChange.Format $dateFormat }}'/>
2023-08-21 10:07:01 +09:00
{{- end -}}
{{- end -}}
{{- with .Site.Params.opengraph.facebook -}}
{{- with .appid -}}
<meta property='fb:app_id' content='{{ . }}'>
{{- end -}}
{{- range .admins -}}
<meta property='fb:admins' content='{{ . }}'>
{{- end -}}
{{- end -}}
{{- partial "social/twitter" . -}}