From 750727091bdc7723c5e780bb9872c9b538314c3a Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Thu, 7 Sep 2023 03:58:40 +0200 Subject: Structured data instead of internal templates of social media --- layouts/_default/single.html | 2 +- layouts/partials/head.html | 11 +++----- layouts/partials/post.html | 2 +- layouts/partials/structured-data.html | 51 +++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 layouts/partials/structured-data.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6538e4f..77b7f97 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,7 +8,7 @@

{{ . }}

{{end}} - {{ with resources.Get (index .Params.images 0) | default (resources.Get .Params.image) }} + {{ with resources.Get (index .Params.images 0) }} {{ $image := .Fill (default "400x400" $.Params.image_size) }}
{{ .Title }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index bd6d93f..3a569e7 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,19 +1,16 @@ - -{{ template "_internal/twitter_cards.html" . }} -{{ template "_internal/opengraph.html" . }} + {{ partial "structured-data.html" . }} {{ with resources.Get "scss/style.scss" | resources.ToCSS (dict "includePaths" (slice "node_modules") "targetPath" "css/style.css") | resources.Minify | fingerprint }} {{ end }} - {{ $title := print .Site.Title " | " .Title }} - {{ if .IsHome }}{{ $title = .Site.Title }}{{ end }} - - {{ $title }} + {{ range .AlternativeOutputFormats -}} {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} + + diff --git a/layouts/partials/post.html b/layouts/partials/post.html index 53aa735..c1e66d5 100644 --- a/layouts/partials/post.html +++ b/layouts/partials/post.html @@ -2,7 +2,7 @@

{{.Title }}

- {{ with resources.Get (index .Params.images 0) | default (resources.Get .Params.image) }} + {{ with resources.Get (index .Params.images 0) }} {{ $image := .Resize (default "320x" .Params.thumbnail_size) }}
diff --git a/layouts/partials/structured-data.html b/layouts/partials/structured-data.html new file mode 100644 index 0000000..8d4e917 --- /dev/null +++ b/layouts/partials/structured-data.html @@ -0,0 +1,51 @@ +{{ $title := print .Site.Title " | " .Title }} +{{ if .IsHome }}{{ $title = .Site.Title }}{{ end }} +{{ $title }} + +{{ with resources.Get (index .Params.images 0) }} +{{ $image := .Fill (default "400x400" $.Params.image_size) }} + + + +{{ else }} + +{{ end }} + + +{{ with .Site.Social.twitter -}} + +{{ end -}} + + + + + + +{{- if .IsPage }} +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + +{{ with .PublishDate }}{{ end }} +{{ with .Lastmod }}{{ end }} +{{- end -}} + +{{- with .Params.audio }}{{ end }} +{{- with .Params.locale }}{{ end }} +{{- with .Site.Params.title }}{{ end }} +{{- with .Params.videos }}{{- range . }} + +{{ end }}{{ end }} + +{{- /* If it is part of a series, link to related articles */}} +{{- $permalink := .Permalink }} +{{- $siteSeries := .Site.Taxonomies.series }} +{{- if $siteSeries }} +{{ with .Params.series }}{{- range $name := . }} + {{- $series := index $siteSeries ($name | urlize) }} + {{- range $page := first 6 $series.Pages }} + {{- if ne $page.Permalink $permalink }}{{ end }} + {{- end }} +{{ end }}{{ end }} +{{- end }} + +{{- /* Facebook Page Admin ID for Domain Insights */}} +{{- with .Site.Social.facebook_admin }}{{ end }} -- cgit v1.2.3