Add option to configure portable links behaviour: off, error or warning

This commit is contained in:
Alex Shpak
2025-09-27 00:05:41 +02:00
parent 7960aa3672
commit 6a134d4fe9
4 changed files with 20 additions and 6 deletions
@@ -13,7 +13,13 @@
{{- else with (resources.Get $path) -}}
{{- $destination = .RelPermalink -}}
{{- else -}}
{{- warnf "Image reference '%s' not found in '%s'" .Destination .Page.Permalink -}}
{{- $mode := .Page.Site.Params.BookPortableLinks -}}
{{- $message := printf "Image reference '%s' not found in '%s'" .Destination .Page.RelPermalink -}}
{{- if eq $mode "warning" -}}
{{- warnf $message -}}
{{- else if eq $mode "error" -}}
{{- errorf $message -}}
{{- end -}}
{{- end -}}
{{- with $url.RawQuery -}}
@@ -16,7 +16,13 @@
{{- else with (resources.Get $path) -}}
{{- $destination = .RelPermalink -}}
{{- else -}}
{{- warnf "Reference '%s' not found in '%s'" .Destination .Page.RelPermalink -}}
{{- $mode := .Page.Site.Params.BookPortableLinks -}}
{{- $message := printf "Image reference '%s' not found in '%s'" .Destination .Page.RelPermalink -}}
{{- if eq $mode "warning" -}}
{{- warnf $message -}}
{{- else if eq $mode "error" -}}
{{- errorf $message -}}
{{- end -}}
{{- end -}}
{{- with $url.RawQuery -}}