mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-07 00:58:13 +00:00
115 lines
3.4 KiB
HTML
115 lines
3.4 KiB
HTML
<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.cover -}}
|
|
{{- $type := ( printf "%T" . ) -}}
|
|
{{- $isMap := ( not ( eq $type "string" ) ) -}}
|
|
|
|
{{- $image := "" -}}
|
|
{{- if $isMap -}}
|
|
{{- $image = .image -}}
|
|
{{- else -}}
|
|
{{- $image = . -}}
|
|
{{- end -}}
|
|
|
|
{{- $image = ( replaceRE "^\\./" $.RelPermalink $image ) -}}
|
|
|
|
<meta property='og:image' content='{{- $image | absURL -}}'>
|
|
{{- end -}}
|
|
|
|
{{- with .Params.images -}}
|
|
{{- range first 5 . -}}
|
|
<meta property='og:image' content='{{ ( replaceRE "^\\./" $.RelPermalink . ) | absURL }}'>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- if not ( or .Params.images .Params.cover ) -}}
|
|
{{- range $authorID := .Params.authors -}}
|
|
{{- $author := ( index $.Site.Data.authors $authorID ) -}}
|
|
{{- with $author -}}
|
|
{{- if or .social.email ( and .email.username .email.host ) -}}
|
|
<meta property='og:image' content='https://www.gravatar.com/avatar/
|
|
{{- with .social.email -}}
|
|
{{- . | md5 -}}
|
|
{{- else -}}
|
|
{{- with .email -}}
|
|
{{- ( print .username "@" .host ) | md5 -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
?s=256'>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- with .Params.audios -}}
|
|
{{- range first 5 . -}}
|
|
<meta property='og:audio' content='{{ ( replaceRE "^\\./" $.RelPermalink . ) | absURL }}'>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- with .Params.videos -}}
|
|
{{- range first 5 . -}}
|
|
<meta property='og:video' content='{{ ( replaceRE "^\\./" $.RelPermalink . ) | absURL }}'>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- if .IsPage -}}
|
|
{{- range $authorID := .Params.authors -}}
|
|
{{- $author := ( index $.Site.Data.authors $authorID ) -}}
|
|
{{- with $author.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 -}}'>
|
|
{{- 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 -}}
|
|
{{- if not .Site.LastChange.IsZero -}}
|
|
<meta property='og:updated_time' content='{{ .Site.LastChange.Format $dateFormat }}'/>
|
|
{{- 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 "head/opengraph/twitter" . -}}
|