1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 14:28:04 +00:00
_/caddy-md/srv/index.html

16 lines
502 B
HTML
Raw Normal View History

2023-12-28 23:11:47 +09:00
<!DOCTYPE html>
{{- $path := .OriginalReq.URL.Path}}
{{- if hasSuffix "/" $path}}{{$path = print $path "index"}}{{end}}
{{- $path = print $path ".md"}}
{{- if not (fileExists $path)}}{{httpError 404}}{{end}}
{{- $markdown := (include $path | splitFrontMatter)}}
{{- $title := default (trimSuffix ".md" (base $path)) $markdown.Meta.title}}
<html lang="ja">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>{{$title}}</title>
{{markdown $markdown.Body | trim}}
</html>