diff --git a/caddy-md/Caddyfile b/caddy-md/Caddyfile new file mode 100644 index 0000000..6f254dc --- /dev/null +++ b/caddy-md/Caddyfile @@ -0,0 +1,5 @@ +:8080 { + file_server + templates + try_files {path} / +} diff --git a/caddy-md/compose.yml b/caddy-md/compose.yml new file mode 100644 index 0000000..ff4353a --- /dev/null +++ b/caddy-md/compose.yml @@ -0,0 +1,8 @@ +services: + caddy: + image: caddy + ports: + - 8080:8080 + volumes: + - ./Caddyfile:/etc/caddy/Caddyfile + - ./srv:/srv diff --git a/caddy-md/srv/a.md b/caddy-md/srv/a.md new file mode 100644 index 0000000..06b863f --- /dev/null +++ b/caddy-md/srv/a.md @@ -0,0 +1 @@ +# あ diff --git a/caddy-md/srv/index.html b/caddy-md/srv/index.html new file mode 100644 index 0000000..b631e39 --- /dev/null +++ b/caddy-md/srv/index.html @@ -0,0 +1,15 @@ + +{{- $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}} + + + +