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