implement custom userdata, resolves #11

This commit is contained in:
zyl 2024-11-13 12:29:26 -08:00
parent 6c31ccb9d5
commit 95a0765b1e
Signed by: zyl
SSH key fingerprint: SHA256:uxxbSXbdroP/OnKBGnEDk5q7EKB2razvstC/KmzdXXs
4 changed files with 35 additions and 0 deletions

View file

@ -30,3 +30,28 @@ the main html content for the page to be rendered. can be rendered anywhere you
{% block content %}{{ page | safe }}{% endblock content %}
</main>
```
### `userdata`
custom userdata provided by the page to be rendered.
if a page defines its userdata as follows:
```yaml
userdata:
value: 5
```
you may use it like so:
```tera
{{ userdata.value }}
```
or, to only use it only if it exists:
```tera
{% if userdata is object and 'value' in userdata %}
{{ userdata.value }}
{% endif %}
```