feat: add archives page
This commit is contained in:
parent
117bf0467c
commit
d5a3174a94
1 changed files with 16 additions and 11 deletions
|
@ -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 %}
|
||||||
|
{% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
|
||||||
|
{% if forloop.first %}
|
||||||
|
<a href="/archives/{{ this_year }}" id="{{ this_year }}-ref">{{this_year}}</a>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
{% if this_year != next_year %}
|
||||||
|
<a href="/archives/{{ next_year }}" id="{{ next_year }}-ref">{{next_year}}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
|
||||||
{% else %}
|
</ol>
|
||||||
<span>No posts to show.</span>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue