2025-01-29 22:17:39 +01:00
|
|
|
{{- $pageParam := index .page.Params .param }}
|
2025-02-05 08:33:02 +01:00
|
|
|
{{- $siteParam := index site.Params .param }}
|
|
|
|
{{- $applyErrorIgnore := .applyErrorIgnore | default true }}
|
2025-01-29 22:17:39 +01:00
|
|
|
{{- $errorlevel := or (and $pageParam $pageParam.errorlevel) (and $siteParam $siteParam.errorlevel) }}
|
2025-02-05 08:33:02 +01:00
|
|
|
{{- $errorignore := slice | append (.page.Params.errorignore | default slice ) | append (site.Params.errorignore | default slice ) }}
|
|
|
|
{{- if and (eq $errorlevel "warning") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }}
|
2025-01-29 22:17:39 +01:00
|
|
|
{{- warnf .msg }}
|
2025-02-05 08:33:02 +01:00
|
|
|
{{- else if and (eq $errorlevel "error") (partial "inline/show-error" (dict "errorignore" $errorignore "url" .url "applyErrorIgnore" $applyErrorIgnore)) }}
|
2025-01-29 22:17:39 +01:00
|
|
|
{{- errorf .msg }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "partials/inline/show-error" }}
|
|
|
|
{{- $ret := true }}
|
2025-02-05 08:33:02 +01:00
|
|
|
{{- if .applyErrorIgnore }}
|
|
|
|
{{- range .errorignore }}
|
|
|
|
{{- if findRE . $.url 1 }}
|
|
|
|
{{- $ret = false }}
|
|
|
|
{{- break }}
|
|
|
|
{{- end }}
|
2025-01-29 22:17:39 +01:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- return $ret }}
|
|
|
|
{{- end }}
|