Add option to configure portable links behaviour: off, error or warning
This commit is contained in:
@@ -136,8 +136,9 @@ enableGitInfo = true
|
|||||||
# /!\ This is an experimental feature, might be removed or changed at any time
|
# /!\ This is an experimental feature, might be removed or changed at any time
|
||||||
# (Optional, experimental, default false) Enables portable links and link checks in markdown pages.
|
# (Optional, experimental, default false) Enables portable links and link checks in markdown pages.
|
||||||
# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
|
# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
|
||||||
# Theme will print warning if page referenced in markdown does not exists.
|
# Theme will print warning or error if page referenced in markdown does not exists.
|
||||||
BookPortableLinks = true
|
# Possible values are false | 'warning' | 'error'
|
||||||
|
BookPortableLinks = 'warning'
|
||||||
|
|
||||||
# /!\ This is an experimental feature, might be removed or changed at any time
|
# /!\ This is an experimental feature, might be removed or changed at any time
|
||||||
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
|
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
|
||||||
|
|||||||
@@ -120,8 +120,9 @@ params:
|
|||||||
# /!\ This is an experimental feature, might be removed or changed at any time
|
# /!\ This is an experimental feature, might be removed or changed at any time
|
||||||
# (Optional, experimental, default false) Enables portable links and link checks in markdown pages.
|
# (Optional, experimental, default false) Enables portable links and link checks in markdown pages.
|
||||||
# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
|
# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
|
||||||
# Theme will print warning if page referenced in markdown does not exists.
|
# Theme will print warning or error if page referenced in markdown does not exists.
|
||||||
BookPortableLinks: true
|
# Possible values are false | 'warning' | 'error'
|
||||||
|
BookPortableLinks: 'warning'
|
||||||
|
|
||||||
# /!\ This is an experimental feature, might be removed or changed at any time
|
# /!\ This is an experimental feature, might be removed or changed at any time
|
||||||
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
|
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
|
||||||
|
|||||||
@@ -13,7 +13,13 @@
|
|||||||
{{- else with (resources.Get $path) -}}
|
{{- else with (resources.Get $path) -}}
|
||||||
{{- $destination = .RelPermalink -}}
|
{{- $destination = .RelPermalink -}}
|
||||||
{{- else -}}
|
{{- 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 -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- with $url.RawQuery -}}
|
{{- with $url.RawQuery -}}
|
||||||
|
|||||||
@@ -16,7 +16,13 @@
|
|||||||
{{- else with (resources.Get $path) -}}
|
{{- else with (resources.Get $path) -}}
|
||||||
{{- $destination = .RelPermalink -}}
|
{{- $destination = .RelPermalink -}}
|
||||||
{{- else -}}
|
{{- 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 -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- with $url.RawQuery -}}
|
{{- with $url.RawQuery -}}
|
||||||
|
|||||||
Reference in New Issue
Block a user