59 lines
2 KiB
HTML
59 lines
2 KiB
HTML
{% macro sectionlisting(section) %}
|
|
<table style="width: 100%;">
|
|
{{ self::postlist(section=section) }}
|
|
</table>
|
|
{% endmacro postlisting %}
|
|
|
|
{% macro postlisting(posts) %}
|
|
<table style="width: 100%;">
|
|
{% for post in posts %}
|
|
{{ self::display_post(post=post) }}
|
|
{% endfor %}
|
|
</table>
|
|
{% endmacro postlisting %}
|
|
|
|
{% macro postlist(section) %}
|
|
{% set post_paths = self::recursive_visit(section=section) %}
|
|
{% set_global posts = [] %}
|
|
{% for path in post_paths | split(pat="&") %}
|
|
{% set clean_path = path | trim %}
|
|
{% if clean_path == "" %}{% continue %}{% endif %}
|
|
{% set post = get_page(path=clean_path) %}
|
|
{% set_global posts = posts | concat(with=post) %}
|
|
{% endfor %}
|
|
|
|
{% for post in posts | sort(attribute="date") | reverse %}
|
|
{{ self::display_post(post=post) }}
|
|
{% endfor %}
|
|
{% endmacro %}
|
|
|
|
{% macro recursive_visit(section) %}
|
|
{% if section.extra.include_posts == true %}
|
|
{% for page in section.pages %}{{ page.relative_path }}&{% endfor %}
|
|
{% for sub in section.subsections %}
|
|
{{ self::recursive_visit(section=get_section(path=sub)) }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro display_post(post) %}
|
|
{% if not post.draft %}
|
|
<tr class="postlisting-row">
|
|
<td>
|
|
<span style="font-size: 1.2em;">
|
|
<a href="{{ post.permalink }}" class="brand-colorlink">{{ post.title }}</a>
|
|
</span>
|
|
<br />
|
|
<small>
|
|
{{ post.reading_time }} min read - Posted {% if post.extra.author %}by {{ post.extra.author }}{% endif %}
|
|
on {{ post.date }}
|
|
</small>
|
|
</td>
|
|
{% if post.tags %}
|
|
<td style="text-align: right;" class="hidden-sm">
|
|
<small>{{ post.tags | join(sep=", ") }}</small>
|
|
</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endif %}
|
|
{% endmacro %}
|