From d6b22825827ed5d2153008b8f123e11374be3363 Mon Sep 17 00:00:00 2001 From: Maciej Sawicki Date: Wed, 16 Dec 2020 12:13:30 +0100 Subject: [PATCH] templates: Fix series detection in opengraph When inside front matter you specified series with spaces, then the opengraph template wouldn't detect other articles, because in `.Site.Taxonomies.series` they are stored by urlized key. Example: ```yaml series: - My Series ``` ```gohtml {{/* in a template */}} {{- $series := index .Site.Taxonomies.series$name }} {{/* was resolved to */}} {{- $series := index {'my-series': ...} "MySeries" }} ``` (cherry picked from commit d2d493ab5d6a054001a8448ea0de2949dac4b30e) --- layouts/partials/templates/opengraph.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index 834e3a12..c0a647df 100644 --- a/layouts/partials/templates/opengraph.html +++ b/layouts/partials/templates/opengraph.html @@ -46,7 +46,7 @@ {{- $permalink := .Permalink }} {{- $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }} {{- range $name := . }} - {{- $series := index $siteSeries $name }} + {{- $series := index $siteSeries ($name | urlize) }} {{- range $page := first 6 $series.Pages }} {{- if ne $page.Permalink $permalink }}{{ end }} {{- end }}