Throw error in include shortcode if file not found

This commit is contained in:
BBaoVanC 2023-10-16 20:35:05 -05:00
parent 0ddf0bdf42
commit 289f55dc19
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
1 changed files with 7 additions and 4 deletions

View File

@ -9,9 +9,12 @@
{{ $path = .Get 0 }}
{{ end }}
{{ if $markdown }}
{{ $path | readFile | .Page.RenderString (dict "display" "block") }}
{{ with ($path | readFile) }}
{{ if $markdown }}
{{ $path | readFile | $.Page.RenderString (dict "display" "block") }}
{{ else }}
{{ $path | readFile }}
{{ end }}
{{ else }}
{{ $path | readFile }}
{{ errorf "file not found: %s" $path }}
{{ end }}