From 4291fc5f1c992a499fbc82decc3fe8090d4dff68 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 4 Jul 2024 12:33:45 +0200 Subject: Improve and clean up the example config for templates --- example/tpl/render_gemtext.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'example/tpl/render_gemtext.html') diff --git a/example/tpl/render_gemtext.html b/example/tpl/render_gemtext.html index 0cfdec6..34a8c7c 100644 --- a/example/tpl/render_gemtext.html +++ b/example/tpl/render_gemtext.html @@ -1,7 +1,6 @@ -{{ $pathSplit := splitList "/" .OriginalReq.URL.Path }} -{{ $base := last $pathSplit | default "index.html" }} -{{ $newBase := trimSuffix (ext $base) $base | printf "%s.gmi" }} -{{ $filePath := append (initial $pathSplit) $newBase | join "/" | printf "static%s" }} +{{ $pathSplit := splitList "/" .Req.URL.Path }} +{{ $base := last $pathSplit | default "index.gmi" }} +{{ $filePath := append (initial $pathSplit) $base | join "/" | printf "static%s" }} {{ if not (fileExists $filePath) }}{{ httpError 404 }}{{ end }} -- cgit v1.2.3