From ba40802b873596d52dd41e4276ab4e6c2f80e3b5 Mon Sep 17 00:00:00 2001 From: barefootstache Date: Mon, 9 Sep 2024 15:56:35 +0200 Subject: [PATCH 1/3] feat: initiate `blogDir` setting Signed-off-by: barefootstache --- exampleSite/config/_default/params.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 65574536..bc59708e 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -102,6 +102,9 @@ languageMenuName = "🌐" # Enable or disable comments globally. Default to true. # comments = false +# Activate meta ld+json for blog +blogDir = "post" + # Enable or disable Utterances (https://github.com/utterance/utterances) Github Issue-Based Commenting # utterances = true # Run the utterances script in the single.html layout to load https://utteranc.es comments # utterancesRepo = "GHUsername/Repository.Name" # Utterances is enabled when this param is set From 779c7e1824ca7020c8e5346d0e6e944a4431114b Mon Sep 17 00:00:00 2001 From: barefootstache Date: Mon, 9 Sep 2024 15:59:54 +0200 Subject: [PATCH 2/3] feat: extend with keywords and categories Signed-off-by: barefootstache --- layouts/partials/opengraph.html | 40 ++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html index cfc2aca2..b535d1ac 100644 --- a/layouts/partials/opengraph.html +++ b/layouts/partials/opengraph.html @@ -59,20 +59,46 @@ -{{- $keywords := "" }} +{{- $mergedKeywords := slice }} {{- with $s.keywords }} - {{- $keywords = delimit $s.keywords "," }} + {{- range . }} + {{- $mergedKeywords = $mergedKeywords | append . }} + {{- end }} {{- end }} {{- with $p.keywords }} - {{- $keywords = delimit . "," }} + {{- range . }} + {{- $mergedKeywords = $mergedKeywords | append . }} + {{- end }} +{{- end }} +{{- with $s.tags }} + {{- range . }} + {{- $mergedKeywords = $mergedKeywords | append . }} + {{- end }} {{- end }} -{{- with $keywords }} - +{{- with $p.tags }} + {{- range . }} + {{- $mergedKeywords = $mergedKeywords | append . }} + {{- end }} +{{- end }} +{{- $mergedKeywordsString := delimit $mergedKeywords "," }} +{{- with $mergedKeywordsString }} + {{- end }} {{- if eq .Section $s.blogDir -}} {{- $date := ( .Date.Format "2006-02-01") -}} {{- $date := (time .Date) }} {{- $lastMod := (time .Lastmod) }} + {{- $categories := slice }} + {{- with $s.categories }} + {{- range . }} + {{- $categories = $categories | append . }} + {{- end }} + {{- end }} + {{- with $p.categories }} + {{- range . }} + {{- $categories = $categories | append . }} + {{- end }} + {{- end }}