mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2024-11-10 00:27:21 +01:00
Better template documentation
This commit is contained in:
parent
f2e9e36e99
commit
2f9f01e947
25
README.md
25
README.md
@ -34,12 +34,33 @@ A less sane, but better for testing version can be found in [echoip_test.toml](e
|
||||
|
||||
Templates in the templates folder exist for every rich page that `echoip-slatecave` supports.
|
||||
|
||||
The code that rendeers them can be found in [src/templating_engine.rs](src/templating_engine.rs).
|
||||
|
||||
There is a configuration file for templates which by default is the `extra.toml` file in the template directory. Its content is exposed to the templates in the `extra` struct.
|
||||
|
||||
The default templates should make use of everything exposed to the templating part, the `data.result` or `data` object is usually what you get when you ask for the json version.
|
||||
|
||||
In addition to that the following fields are accessible from inside the template:
|
||||
|
||||
`view`
|
||||
: The views name (the basename of the template file, i.e. `404` or `ip`)
|
||||
|
||||
`format`
|
||||
: The format name (`html`, `text`, `json`)
|
||||
|
||||
`mimetype`
|
||||
: The resulting mimetype (i.e. `text/plain; charset=utf-8`)
|
||||
|
||||
`http_status`
|
||||
: The numeric HTTP Status-Code at the time of rendering the template.
|
||||
|
||||
`language`
|
||||
: The language requested by the browser.
|
||||
|
||||
`dns_resolvers`
|
||||
: A list of [Selectable](src/settings.rs) structs representing the available DNS-Resolvers.
|
||||
|
||||
`dns_resolver_id`
|
||||
: The id of the currently selected DNS-Resolver
|
||||
|
||||
The templates are covered by the AGPL as well, please share them with your users if you modified them.
|
||||
|
||||
### GeoLite2 database
|
||||
|
Loading…
Reference in New Issue
Block a user