1

Blog post listing

This commit is contained in:
Evan Pratten 2022-11-25 14:39:10 -05:00
parent cb2ceb0c0d
commit d9c0478069
2 changed files with 32 additions and 2 deletions
content/blog
templates

@ -2,7 +2,7 @@
title: Blog
sort_by: date
extra:
inject_blog_posts: true
section_embed_mode: blog_posts
---
## Blog posts

@ -12,5 +12,35 @@
{% include "components/heading-card.html" %}
{% endblock page_start %}
{% block content %}
{{ section.content | safe }}
{{ section.content | safe }}
{# Handle various embed modes #}
{% if section.extra.section_embed_mode %}
{% if section.extra.section_embed_mode == "blog_posts" %}
{# <ul style="margin:0"> #}
<div>
{# Posts shall be broken down by year #}
{% set title_year = "3000" %}
{% for page in section.pages %}
{% if not page.extra.hidden %}
{% set page_year = page.date | date(format="%Y")%}
{% if page_year != title_year %}
{% set_global title_year = page_year %}
</ul>
<h2>{{title_year}}</h2>
<ul>
{% endif %}
<li class="blog-post-li"><span style="color:{% if page.draft %}red{% else %}gray{% endif %};">{{page.date}}:</span>
<a href="{{page.path}}">{{page.title}}</a>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endif %}
{% endif %}
{% endblock content %}