Sam Hames

Currently: “Oh good, change is coming.”

Template Fragments

https://htmx.org/essays/template-fragments/

Outlines template-fragments as a way to tackle nicely structuring your HTML templates in applications like HTMX and Unpoly.

The basic idea of template fragments is that you write your template as a full page template, but have a structured way to pull out specific fragments from the page for use in a context where you only want to render part of the page. This avoids having to maintain lots of little templates for different purposes - just define the full page and grab fragments from that as needed.

This does seem to need some way for your template library to be aware of more of the structure of your documents? I'm also wondering where to use this next to things like template macros and other nice things, such as Jinja provides.

Tags

Related By Tags

Details

Revised
Created
Edited