Closed spanezz closed 4 years ago
Another option: open .html files, look at the first line. If it's {#---
, {#{
, or {#+++
, parse until the first line that ends with #}
as front matter, and use it as a template. Otherwise, consider it an asset.
Another option:
*.html
jinja2 templates unless they have asset: yes
in the metadata..staticsite
that some files are jinja2 templates even if they are not .html
filesIt's possible to get at a block in a compiled jinja2 template: we can cleanly have front matter in jinja2 as:
{% block front_matter %}
---
title: Page title
{% endblock %}
Currently the
.j2.
marker in file names is used to distinguish static assets from jinja2 templates.Now that we have directory metadata, we potentially have a way to tell the j2 feature a list or glob of files to read as templates regardless of their name.
For example, a
.staticsite
file could have a way to pass information to features:this seems rather verbose. Alternatively, allow
files
to be a glob, and use its metadata to communicate with features:this sounds flexible but not really straightforward. Another option can be to say that if one provides extra metadata for a
.html
file, then the j2 feature would automatically consider it a template:And if in the future this causes static assets to be wrongly interpreted as templates, one could easily add a
static: yes
metadata to disable it on a file by file basis.