1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 13:58:08 +00:00

create caddy-md

This commit is contained in:
Nebel 2023-12-28 23:11:47 +09:00
parent e353a7db6a
commit c8b2ae0f07
Signed by: nebel
GPG key ID: 79807D08C6EF6460
5 changed files with 38 additions and 0 deletions

5
caddy-md/Caddyfile Normal file
View file

@ -0,0 +1,5 @@
:8080 {
file_server
templates
try_files {path} /
}

8
caddy-md/compose.yml Normal file
View file

@ -0,0 +1,8 @@
services:
caddy:
image: caddy
ports:
- 8080:8080
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./srv:/srv

1
caddy-md/srv/a.md Normal file
View file

@ -0,0 +1 @@
# あ

15
caddy-md/srv/index.html Normal file
View file

@ -0,0 +1,15 @@
<!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>

9
caddy-md/srv/index.md Normal file
View file

@ -0,0 +1,9 @@
---
title: トップ
---
# トップページ
こんにちは、世界
- [a](a)