You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a jinja2 template that lists all the pages in a folder (little html files representing projects in my /projects dir) showing their meta attributes like title, description and putting some links as details, if present, taken from a list of meta attributes (github in the example).
Given the scarce documentation out there, this is what I've come up with:
{% for res in resource.node['resources']|sort(attribute='meta.created') %}
{% if res.meta.title != 'projects' %}
<h2><a href="{{res.url}}">{{res.meta.title}}</a></h2>
<p> {{res.meta.description}}
{% set show_details = [] %}
{{res.meta.__dict__}}
{% for d in details %}
{% if d in res.meta.__dict__ %}
{% do show_details.append(d) %}
{% endif %}
{% endfor %}
{% if show_details %}
[{% for d in show_details %}
<a href="{{res.meta.__dict__[d]}}">{{d}}</a>
{% if loop.index < show_details|length %}
|
{% endif %}
{% endfor %}]
{% endif %}
</p>
<!--<hr/>-->
{% endif %}
{% endfor %}
This seems to get the job done, however I am not totally satisfied with it, so I am asking:
is there a better, 'native' way in Hyde to achieve this?
the side effect of this approach is that the above template is not compiled again when I simply modify my files in project folder and then call hyde gen, is this solvable?
The text was updated successfully, but these errors were encountered:
I am trying to create a jinja2 template that lists all the pages in a folder (little html files representing projects in my
/projects
dir) showing their meta attributes liketitle
,description
and putting some links as details, if present, taken from a list of meta attributes (github
in the example).Given the scarce documentation out there, this is what I've come up with:
This seems to get the job done, however I am not totally satisfied with it, so I am asking:
hyde gen
, is this solvable?The text was updated successfully, but these errors were encountered: