From cc40a43b00ab7c0a154a39c52aac7750a08682f9 Mon Sep 17 00:00:00 2001 From: a Date: Mon, 26 Feb 2024 12:22:30 -0600 Subject: [PATCH] seo fixes --- layouts/partials/seo.html | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/layouts/partials/seo.html b/layouts/partials/seo.html index 638018b..a05df8c 100644 --- a/layouts/partials/seo.html +++ b/layouts/partials/seo.html @@ -1,11 +1,15 @@ +{{- $firstH1 := partial "name.html" . }} +{{- $title := or .Title $firstH1 $.File.ContentBaseName }} +{{- $name := or .Params.name (print $title " - " .Site.Title) }} + +{{- $cover := ($.Resources.ByType "image").GetMatch "{*cover*,*thumbnail*,*featured*}" -}} +{{ $icon := resources.GetMatch (default "" .Site.Params.icon) -}} + {{/*=== title ===*/}} {{ "" | safeHTML }} {{- with .Site.Title }} {{- end -}} -{{- $firstH1 := partial "name.html" . }} -{{- $title := or .Title $firstH1 $.File.ContentBaseName }} -{{- $name := or .Params.name (print $title " - " .Site.Title) }} {{- if .IsHome}} {{- $name = or .Params.name .Site.Title }} {{- end }} @@ -28,8 +32,6 @@ {{- end -}} {{/*=== image ===*/}} -{{- $cover := ($.Resources.ByType "image").GetMatch "{*cover*,*thumbnail*,*featured*}" -}} -{{ $icon := resources.GetMatch (default "" .Site.Params.icon) -}} {{- $staticIcon := "icon.png" | absURL -}} {{- with or $cover $icon }} {{ "" | safeHTML }} @@ -59,8 +61,8 @@ {{- end -}} {{/*=== published and updated ===*/}} -{{ "" | safeHTML -}} -{{ with .Date }} +{{- "" | safeHTML }} +{{ with .Date -}} {{ end -}} @@ -69,7 +71,7 @@ {{ end -}} {{/*=== section and keywords ===*/}} -{{- "" | safeHTML }} +{{- "" | safeHTML -}} {{ with.Params.category -}} {{- end -}} @@ -91,7 +93,7 @@ "url": {{ .Site.BaseURL }} }, "datePublished": {{ .Date.UTC.Format "2006-01-02T03:04:05Z" }}, - "description": {{ or .Description .Summary }}, + "description": {{ (or .Description .Summary) | plainify }}, "wordCount": {{ .WordCount }}, "mainEntityOfPage": {{.Permalink}}, "dateModified": "{{ .Lastmod.UTC.Format "2006-01-02T03:04:05Z" }}", @@ -114,14 +116,14 @@ {{ "" | safeHTML }} {{- end -}} @@ -140,6 +142,6 @@ {{- end -}} {{/* robots */}} -{{- "" | safeHTML }} +{{ "" | safeHTML }} \ No newline at end of file