feat: add archives page

This commit is contained in:
Ayo Ayco 2024-05-14 02:23:45 +02:00
parent 117bf0467c
commit d5a3174a94

View file

@ -1,19 +1,24 @@
--- ---
layout: category layout: default
category-name: entertainment
title: Entertainment Posts
permalink: /entertainment/
--- ---
<h1>Entertainment Posts</h1> <h1>Archives</h1>
<div class="blog-home"> <div class="blog-home">
{% if site.categories.entertainment.size > 0 %} {% if site.posts.size > 0 %}
<ul class="blog-home__list-items"> {% for post in site.posts %}
{% for post in site.categories.entertainment %}{% include post-item.html %} {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% endfor %} {% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
</ul> {% if forloop.first %}
<a href="/archives/{{ this_year }}" id="{{ this_year }}-ref">{{this_year}}</a>
{% else %} {% else %}
<span>No posts to show.</span> {% if this_year != next_year %}
<a href="/archives/{{ next_year }}" id="{{ next_year }}-ref">{{next_year}}</a>
{% endif %}
{% endif %}
{% endfor %}
</ol>
{% endif %} {% endif %}
</div> </div>