From 7f3d7b211a4d5da732a21d0ae828a3bcf0aceb6b Mon Sep 17 00:00:00 2001 From: Will Faught Date: Fri, 14 Feb 2025 00:30:59 -0800 Subject: [PATCH] Use term titles for keywords meta value --- layouts/partials/paige/metas.html | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/layouts/partials/paige/metas.html b/layouts/partials/paige/metas.html index cda1cc40..26713d82 100644 --- a/layouts/partials/paige/metas.html +++ b/layouts/partials/paige/metas.html @@ -1,6 +1,29 @@ {{ $page := . }} {{ $description := $page.Description | markdownify | plainify | htmlUnescape }} +{{ $keywords := slice }} + +{{ with $page.Keywords }} + {{ $keywords = . }} +{{ end }} + +{{ with $page.GetTerms "categories" }} + {{ range . }} + {{ $keywords = $keywords | append (.Title | markdownify | plainify | htmlUnescape) }} + {{ end }} +{{ else }} + {{ $keywords = $keywords | append $page.Params.categories }} +{{ end }} + +{{ with $page.GetTerms "tags" }} + {{ range . }} + {{ $keywords = $keywords | append (.Title | markdownify | plainify | htmlUnescape) }} + {{ end }} +{{ else }} + {{ $keywords = $keywords | append $page.Params.tags }} +{{ end }} + +{{ $keywords = delimit ($keywords | uniq | sort) ", " }} @@ -18,8 +41,8 @@ {{ end }} -{{ if or $page.Keywords $page.Params.tags $page.Params.categories }} - +{{ with $keywords }} + {{ end }}