vanilla-hugo/layouts/partials/nameinseries.html
Danila Fedorin b282843b40 Add a 'name in series' helper to re-use logic
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-16 19:35:31 -07:00

9 lines
330 B
HTML

{{- $term := index (.page.GetTerms "series") 0 -}}
{{- $divider := $term.Params.divider -}}
{{- if (and $divider (strings.Contains .page.Title $divider)) -}}
{{- $rest := after 1 (split .page.Title $divider) -}}
{{- .scratch.Set "name" (delimit $rest $divider) -}}
{{- else -}}
{{- .scratch.Set "name" .page.Title -}}
{{- end -}}