aboutsummaryrefslogtreecommitdiff
path: root/example/tpl
diff options
context:
space:
mode:
Diffstat (limited to 'example/tpl')
-rw-r--r--example/tpl/render_gemtext.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/example/tpl/render_gemtext.html b/example/tpl/render_gemtext.html
new file mode 100644
index 0000000..0cfdec6
--- /dev/null
+++ b/example/tpl/render_gemtext.html
@@ -0,0 +1,15 @@
+{{ $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" }}
+{{ if not (fileExists $filePath) }}{{ httpError 404 }}{{ end }}
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>TODO Title</title>
+ <link rel="stylesheet" type="text/css" href="/bamboo.css" />
+ </head>
+ <body>
+ {{ gemtext (include $filePath) }}
+ </body>
+</html>