Templates documentation¶
Templates¶
Namespaces¶
Nemo templates are namespaced since 1.0.0 and the plugin system. Nemo base plugins are in the namespace “main”, the prefix used in Nemo being “::”. For any new template added to Nemo using the original container, it would probably be designed with
{% extends "main::container.html" %}
{%block article%}
Add the HTML here
{%endblock%}
Add and change templates¶
You can add namespace to Nemo by using the templates parameter on initiation, but it can also be used to overwrite templates. For example, given a directory ./templates/main with a file container.html, the following code snippet would write over Nemo original container.html
nemo = Nemo(templates={
"main": "./templates/main"
})
Note
It is recommended to split namespaced templates in different folders when adding templates to the Nemo instance.
Warning
If two declared namespaces share the same directory, there is risk of collision between templates names and thus overwriting potential. For example, if main::
and plugin_1::
point to dir1
, main::file.html
and plugin_1::file.html are the same.
Template choice behaviour in Nemo¶
Nemo Default Templates¶
The following tables gives informations about the variables sent to each templates.
main::index.html¶
main::breadcrumb.html¶
main::textgroups.html¶
See r_collection
Variable Name | Details |
---|---|
textgroups | List of textgroups according to a collection |
main::texts.html¶
main::See r_texts
Variable Name | Details |
---|---|
texts | List of texts according to a textgroup |