mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-25 15:51:28 +00:00
tpl: 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 # in front matter series: - My Series ``` ```gohtml {{/* in a template */}} {{- $series := index .Site.Taxonomies.series$name }} {{/* was resolved to */}} {{- $series := index {'my-series': ...} "MySeries" }} ```
This commit is contained in:
parent
ce96895deb
commit
d2d493ab5d
1 changed files with 1 additions and 1 deletions
|
@ -38,7 +38,7 @@
|
||||||
{{- $permalink := .Permalink }}
|
{{- $permalink := .Permalink }}
|
||||||
{{- $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }}
|
{{- $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }}
|
||||||
{{- range $name := . }}
|
{{- range $name := . }}
|
||||||
{{- $series := index $siteSeries $name }}
|
{{- $series := index $siteSeries ($name | urlize) }}
|
||||||
{{- range $page := first 6 $series.Pages }}
|
{{- range $page := first 6 $series.Pages }}
|
||||||
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
|
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
Loading…
Reference in a new issue