-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.html
24 lines (22 loc) · 896 Bytes
/
post.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{{ $pathParts := splitList "/" .OriginalReq.URL.Path }}
{{ $markdownFilename := default "index" (slice $pathParts 2 | join "/") }}
{{ $markdownFilePath := printf "/posts/%s.md" $markdownFilename }}
{{ if not (fileExists $markdownFilePath) }}{{ httpError 404 }}{{ end }}
{{ $markdownFile := (include $markdownFilePath | splitFrontMatter) }}
{{ $title := default $markdownFilename $markdownFile.Meta.title }}
{{ $description := default $markdownFilename $markdownFile.Meta.description }}
<!DOCTYPE html>
<html>
<head>
{{ include "include/head.html" $title $description }}
<link rel="stylesheet" href="/static/css/post.css">
</head>
<body>
<main id="content">
<h1>{{ $title }} — <a href="/">Home</a></h1>
<span id="markdown">
{{ markdown $markdownFile.Body }}
</span>
</main>
</body>
</html>