feat: render templates in param strings

This commit is contained in:
Ben Goldsworthy 2025-02-20 01:25:22 +01:00
parent 397774be5b
commit dae35f0e05
Signed by: Rumperuu
SSH key fingerprint: SHA256:v3uompaUiPqV2w1/AIRWBSQOxr2dntH9Xs/y8fDnUPU

View file

@ -13,8 +13,8 @@
<!-- Optional parameter overrides (for nested citations) -->
{{- $cite := default .Params.cite ( .Scratch.Get "cite" ) -}}
{{- $title := default .Params.title ( .Scratch.Get "title" ) -}}
{{- $cite := trim ( default .Params.cite ( .Scratch.Get "cite" ) | .Page.RenderString ) "\r\n" -}}
{{- $title := trim ( default .Params.title ( .Scratch.Get "title" ) | .Page.RenderString ) "\r\n" -}}
{{- $titleLang := default .Params.titleLang ( .Scratch.Get "titleLang" ) -}}
{{- $titleTr := default .Params.titleTr ( .Scratch.Get "titleTr" ) -}}
{{- $schemaType := default .Params.schemaType ( .Scratch.Get "schemaType" ) -}}
@ -49,7 +49,7 @@
{{- $itemType := default "CreativeWork" $schemaType -}}
{{- if ( or ( in $.Site.Data.itemtypes $itemType ) ( eq .Params.suppress "true" ) ) -}}
{{- with .Params.href -}}
<a href="{{ if eq . "asCite" }}{{ $cite }}{{ else }}{{ . }}{{ end }}">
<a href="{{- if eq . "asCite" -}}{{- $cite -}}{{- else -}}{{- . -}}{{- end -}}">
{{- end -}}
<cite
class="cite{{ with .Params.citeStyle }} cite--{{ . }}{{ end }}"
@ -61,7 +61,7 @@
title="{{- $titleTr -}}"
{{- end -}}>
{{- with $cite -}}
<meta itemprop="url" content="{{ . }}">
<meta itemprop="url" content="{{- . -}}">
{{- end -}}
<span itemprop="name">
{{- if $titleLang -}}