- Status: approved
- Last Updated: 2021-06-09
- Objective: Organize jinja templates in website
Template organization is an important element for contributor discoverability.
In order to organize our Jinja HTML templates, we decided to use a two-level folder level split. This will be combined with Jinja inheritance (i.e. the extends
clause) for common components where possible.
Concretely, our templates file architecture might look like this:
website/
templates/
campaigns/
view_campaign.html
create_or_edit_campaign.html
users/
view_user.html
...
Templates often mirror API actions (create
, read
, update
, delete
, etc). Since the API itself is organized by data types (e.g. users
, donations
, causes
, etc), we saw it fit to mirror that information hierarchy here.
This organization will not scale well to a significant number of templates. In that case, a more complex hierarchy will need to be created.