diff options
| author | Maciej Sawicki <humberd2@gmail.com> | 2020-12-16 12:13:30 +0100 |
|---|---|---|
| committer | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2020-12-16 18:07:59 +0530 |
| commit | d6b22825827ed5d2153008b8f123e11374be3363 (patch) | |
| tree | e1736360aefd110613b139d6b3f5b6dba1549d05 | |
| parent | f5417ab6d05badb48cf870027421b72b552d0228 (diff) | |
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)
| -rw-r--r-- | layouts/partials/templates/opengraph.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index 834e3a1..c0a647d 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 }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }} {{- end }} |
