From 289f55dc1966148005e34c2ece941941dcc9210c Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Mon, 16 Oct 2023 20:35:05 -0500 Subject: [PATCH] Throw error in include shortcode if file not found --- layouts/shortcodes/include.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/layouts/shortcodes/include.html b/layouts/shortcodes/include.html index f79d408..b5b5e83 100644 --- a/layouts/shortcodes/include.html +++ b/layouts/shortcodes/include.html @@ -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 }}