This repository has been archived on 2025-06-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
joeac.net-symfony/symfony/templates/blog_posts.html.twig

82 lines
2.9 KiB
Twig

{% extends 'base.html.twig' %}
{% block content %}
<section class="h-feed">
<h1 class="p-name">Joe Carstairs' blog</h1>
<p hidden>
This blog is written by
<a class="p-author h-card" href="{{ url('index') }}">
Joe Carstairs
</a>.
</p>
<p hidden>
<a class="u-url" href="{{ url('blog_posts') }}">Permalink</a>
</p>
{% if years %}
<nav class="skip-to">
Skip to:
<ul>
{% for year in years %}
<li><a href="#{{ year }}">{{ year }}</a></li>
{% endfor %}
</ul>
</nav>
{% endif %}
{% for year in years %}
<h2 id="{{ year }}">{{ year }}</h2>
<nav class="skip-to">
Skip to:
<ul>
{% for month in months[year] %}
<li><a href="#{{ year }}-{{ month }}">
{{ monthNames[month] }} <span class="visually-hidden">{{ year }}</span>
</a></li>
{% endfor %}
</ul>
</nav>
{% for month in months[year] %}
<h3 id="{{ year }}-{{ month }}">{{ monthNames[month] }}</h3>
{% for post in posts[year][month] %}
<section class="h-entry">
<a class="u-url" href="{{ path('blog_post', { 'slug': post.slug }) }}">
<h4 class="p-name">
{{ post.title }}
</h4>
<p>
Added:
<time class="dt-published" datetime="{{ post.publishedDate.format('c') }}">
{{ post.publishedDate.format('j F Y') }}
</time>
</p>
{% if post.updatedDate %}
<p>
Updated:
<time class="dt-updated" datetime="{{ post.updatedDate.format('c') }}">
{{ post.updatedDate.format('j F Y') }}
</time>
</p>
{% endif %}
<section class="p-summary">
{% apply markdown_to_html %}
{{ post.description|markdown_to_html|striptags('<i><em><b><strong><sup><p>')|html_to_markdown }}
{% endapply %}
</section>
</a>
</section>
{% endfor %}
{% endfor %}
{% else %}
<p>I have no blog posts.</p>
{% endfor %}
</section>
{% endblock %}