-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
35 lines (28 loc) · 1 KB
/
index.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
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
{{/* https://github.com/dbohdan/caddy-markdown-site */}}
{{ $path := .OriginalReq.URL.Path }}
{{ $append := placeholder "caddy_markdown_site.append_to_path" }}
{{ if eq $append "extension" }}
{{ $path = printf "%s.md" $path }}
{{ else if eq $append "index" }}
{{ $path = printf "%s/index.md" $path }}
{{ end }}
{{ $markdownFile := (include $path | splitFrontMatter) }}
{{ $lang := default "" $markdownFile.Meta.lang }}
{{ $textDir := default "auto" $markdownFile.Meta.text_dir }}
{{ $title := default .OriginalReq.URL.Path $markdownFile.Meta.title }}
<html dir="{{ $textDir }}" lang="{{ $lang }}">
<head>
<title>{{ $title }}</title>
<meta property="og:title" content="{{ $title }}">
<meta name="twitter:title" value="{{ $title }}">
{{ include "/templates/head.html" }}
</head>
<body>
{{ include "/templates/body-header.html" }}
<main>
<article>{{ markdown $markdownFile.Body }}</article>
</main>
{{ include "/templates/body-footer.html" }}
</body>
</html>