diff --git a/layouts/partials/head.html b/layouts/partials/head.html index aadd85d..bf154b8 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -6,6 +6,7 @@ {{ if .Site.Params.noindex }} {{ end }} {{ partialCached "favicon" . }} +{{ partial "opengraph" . }} diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html new file mode 100644 index 0000000..3d2e916 --- /dev/null +++ b/layouts/partials/opengraph.html @@ -0,0 +1,98 @@ +{{- $summary := truncate 160 .Summary }} +{{- $s := .Site.Params }} +{{- $p := .Params }} + +{{- $relpath := "" -}} +{{- if or $s.usePageBundles $p.usePageBundles }} + {{- $relpath = .Page.RelPermalink -}} +{{- end }} + +{{ if eq $p.usePageBundles false }} + {{- $relpath = "" }} +{{ end }} + +{{- with $p.description }} + {{- $summary = truncate 160 . }} +{{- end }} +{{- if .IsHome }} + {{- $summary = $s.description }} + {{- with $p.description }} + {{- $summary = . }} + {{- end }} +{{- end }} +{{- $site := .Site.Title }} +{{- $title := .Title }} +{{- $permalink := .Permalink }} +{{- $logo := absURL $s.logo }} +{{- $author := $s.author }} +{{- with $p.author }} + {{ $author := . }} +{{- end }} +{{- $image := absURL $s.fallBackOgImage }} +{{- with $p.featureImage }} + {{- $fullpath := ( add $relpath . ) -}} + {{- $image = absURL $fullpath }} +{{- end }} +{{- with $p.thumbnail }} + {{- $fullpath := ( add $relpath . ) -}} + {{- $image = absURL $fullpath }} +{{- end }} +{{- with $p.shareImage }} + {{- $fullpath := ( add $relpath . ) -}} + {{- $image = absURL $fullpath }} +{{- end }} + +{{- if .IsHome }} + +{{- else }} + +{{- end }} + + + + + +{{- $keywords := "" }} +{{- with $s.keywords }} + {{- $keywords = delimit $s.keywords "," }} +{{- end }} +{{- with $p.keywords }} + {{- $keywords = delimit . "," }} +{{- end }} +{{- with $keywords }} + +{{- end }} +{{- if eq .Section $s.blogDir -}} + {{- $date := ( .Date.Format "2006-02-01") -}} + {{- $date := (time .Date) }} + {{- $lastMod := (time .Lastmod) }} + +{{- end }}