Adding Archives Page (Take 2)

In my last post, I added archives page to my blog which was displaying correctly on my machine, however when I pushed changes to github, it failed.

Inquiring further, I found out that the plugin which I used, is not supported by Github.

Setup

So I had to find an alternative solution and thanks to this, I could get it working with just couple tweaks.

Firstly, I updated my year-archive.html with the following (similar to the one posted in the above link):

<article class="page">
  <h1>{{ page.title }}</h1>
  <div class="entry">    
    {% assign previousYear = "" %}
    {% for post in site.posts %}
      {% capture currentYear %}
        {{ post.date | date: "%Y" }}
      {% endcapture %}
    
      {% if currentYear != previousYear %}
        {% assign previousYear = currentYear %}
        <h3>{{ currentYear }}</h3>
      {% endif %}
    
      {{ post.date | date: '%B %d, %Y' }} - <a style="font-weight: bold" href="{{ post.url }}">{{ post.title }}</a>
      <br />
    {% endfor %}    
  </div>
</article>

And removed all the plugin references from Gemfile, _config.yml. That’s It!!!

Related Posts