diff options
author | Brian Picciano <me@mediocregopher.com> | 2024-07-03 12:36:05 +0200 |
---|---|---|
committer | Brian Picciano <me@mediocregopher.com> | 2024-07-03 12:36:05 +0200 |
commit | 7e1ecc4df44d20d2c9de1c8885ddc2c188062ef0 (patch) | |
tree | ac31b787dbaf6c3c702b508e9529d62ceb221923 /example/tpl | |
parent | 1a6d506a525e32bc374f89377e46a775c6737cf0 (diff) |
Initial implementation of the gemtext template extension
Diffstat (limited to 'example/tpl')
-rw-r--r-- | example/tpl/render_gemtext.html | 15 |
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> |