Files
kumomta/docs/reference/template/joiner.md
T

24 lines
592 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
```rust
pub fn joiner(sep: Option<Value>) -> Value
```
A tiny helper that can be used to “join” multiple sections. A
joiner is passed a string and will return that string every time
its called, except the first time (in which case it returns an
empty string). You can use this to join things:
{% raw %}
```jinja
{% set pipe = joiner("|") %}
{% if categories %} {{ pipe() }}
Categories: {{ categories|join(", ") }}
{% endif %}
{% if author %} {{ pipe() }}
Author: {{ author() }}
{% endif %}
{% if can_edit %} {{ pipe() }}
<a href="?action=edit">Edit</a>
{% endif %}
```
{% endraw %}