jinja macros ━━━━━━━━━━━━ I am working on a page for htmx-patterns and I ran into a situation with lots of duplication. Especially when i am using tailwind I run into situations where... Date: April 7, 2024 I am working on a page for htmx-patterns <https://htmx-patterns.waylonwalker.com> and I ran into a situation with lots of duplication. Especially when i am using tailwind I run into situations where the duplication can get tedious to maintiain. The solution I found is macros. Now I can use the same code for all of my links, and call the macro to use it. [code] {% macro link(id, text, boosted=false) -%} {{ text }} {%- endmacro %}

Boosted Links

{{ link(prev_id, 'Previous', boosted=True) }} {{ link(next_id, 'Next', boosted=True) }}

Normal Links

{{ link(prev_id, 'Previous', boosted=False) }} {{ link(next_id, 'Next', boosted=False) }}