I've built a Jekyll blog that includes a post archive. I developed the archive using the jekyll-archives
plugin. I'm happy with the website and the archive pages are working fine. The problem is that archived posts are also shown on the current website, which is built with jekyll-paginate
.
I don't want archived posts to be shown on the current website because archived posts should be "archived" and only be accessible through the archive pages. Suppose I have posts from 2020 until 2022. I want 2021 and 2020 posts to be archived and appear on the archive pages only whilst the current paginated website lists 2022 posts only. How do I achieve this effect?
My jekyll-archives
configuration in _config.yml
file:
jekyll-archives:
enabled: all
layout: archive
permalinks:
year: '/blogs/archives/:year/'
title: 'Archived :year'
My archive template code:
<h1>Archive of posts from {{ page.date | date: "%Y" }}</h1>
<ul class="posts">
{% for post in page.posts %}
<li>
<span class="post-date">{{ post.date | date: "%b %-d, %Y" }}</span>
<a class="post-link" href="{{ post.url | relative_url }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>