hugo-theme-relearn/layouts/partials/_relearn/dependencies.gotmpl
2024-10-11 16:47:26 +02:00

39 lines
No EOL
2.1 KiB
Go Template

{{- range .Site.Params.relearn.dependencies }}
{{- $has := printf "has%s" .name }}
{{- $disable := printf "disable%s" .name }}
{{- $enable := printf "%s" (lower .name) }}
{{- $wantsPage := false }}
{{- if ne (index $.Params $disable) nil }}
{{- $wantsPage = not (index $.Params $disable) }}
{{- warnf "%q: DEPRECATED front matter 'disable%s' found, use '%s' or '%s.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" $.File.Filename .name (lower .name) (lower .name) }}
{{- else if and (eq .name "Math") (ne (index $.Params "disableMathJax") nil) }}
{{- $wantsPage = not (index $.Params "disableMathJax") }}
{{- warnf "%q: DEPRECATED front matter 'disableMathJax' found, use 'math' or 'math.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" $.File.Filename }}
{{- end }}
{{- with index $.Params $enable }}
{{- $wantsPage = or
(and (reflect.IsMap .) (eq (index . "force") true))
(and (not (reflect.IsMap .)) (eq . true))
}}
{{- end }}
{{- $wantsSite := false }}
{{- if ne (index $.Site.Params $disable) nil }}
{{- $wantsSite = not (index $.Site.Params $disable) }}
{{- warnf "DEPRECATED option 'disable%s' found, use '%s' or '%s.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" .name (lower .name) (lower .name) }}
{{- else if and (eq .name "Math") (ne (index $.Site.Params "disableMathJax") nil) }}
{{- $wantsSite = not (index $.Site.Params "disableMathJax") }}
{{- warnf "DEPRECATED option 'disableMathJax' found, use 'math' or 'math.force' instead and invert the value; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }}
{{- end }}
{{- with index $.Site.Params $enable }}
{{- $wantsSite = or
(and (reflect.IsMap .) (eq (index . "force") true))
(and (not (reflect.IsMap .)) (eq . true))
}}
{{- end }}
{{- if or $wantsPage $wantsSite }}
{{- $.Store.Set $has true }}
{{- end }}
{{- end }}