blob: 49b836939a6b00d4c7f476b1292d5509dc340ba8 (
plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
{
debug
admin off
auto_https off
http_port 8000
}
http://gemtext.localhost {
root example/static
# Allow for either index.html or index.gmi files when serving directories
try_files {path} {path}/index.html {path}/index.gmi
handle_path /gemtext/gmisub.rss.xml {
rewrite /gemtext/gmisub.gmi
gemlog_to_feed {
format rss
author_name "Tester"
author_email "nun@ya.biz"
}
file_server
}
handle_path /gemtext/gmisub.atom.xml {
rewrite /gemtext/gmisub.gmi
gemlog_to_feed {
format atom
author_name "Tester"
author_email "nun@ya.biz"
}
file_server
}
handle_path /gemtext/gmisub.json {
rewrite /gemtext/gmisub.gmi
gemlog_to_feed {
format json
author_name "Tester"
author_email "nun@ya.biz"
}
file_server
}
handle {
gemtext {
root example/tpl
template render_gemtext.html
link_template render_gemtext_link.html
}
file_server
}
}
http://templates.localhost {
root example/static
# If a directory has an index.gmi file, then that file will be served when
# the directory is requested.
try_files {path} {path}/index.gmi
@gmi path *.gmi
# Handle all requests for .gmi files specially.
route @gmi {
templates {
# The templates directive is given a different root, so that other
# template snippets within the tpl directory could theoretically be
# used within render_gemtext_with_templates.html.
root example
# Include the gemtext extention to make the gemtext function
# available within the template.
extensions {
gemtext_function {
gateway_url "https://gemini.tildeverse.org/?gemini://"
}
}
}
# We "respond" with a template body here, which will be processed by the
# templates directive above. This body simply imports the template we
# actually want. Setting Content-Type is required because there's no
# actual file for Caddy to determine the value from.
header Content-Type "text/html; charset=utf-8"
respond `{{ include "tpl/render_gemtext_with_templates.html" }}`
}
# All other files are handled directly by the file_server.
file_server
}
|