aboutsummaryrefslogtreecommitdiff
path: root/example/tpl/render_gemtext_with_templates.html
blob: 72e35a4a6ed8cf5499a4bcfc6efd80dbbd52c89f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{{ $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 }}
{{ $gemtextRes := gemtext (include $filePath) }}
<!DOCTYPE html>
<html>
  <head>
    <title>{{ $gemtextRes.Title | default "Example Gemtext File" }}</title>
    <link rel="stylesheet" type="text/css" href="/bamboo.css" />
  </head>
  <body>
    {{ $gemtextRes.Body }}
  </body>
</html>