Skip to content

Commit

Permalink
Fixed:
Browse files Browse the repository at this point in the history
1.  Incorrect heading for previous year's posts in archive.md tocttou#1
2.  Blog year in footer (switched to current year from site.year
  • Loading branch information
tocttou committed Jan 6, 2018
1 parent ce90ea9 commit 489b4c6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ plugins:

# Custom variables
owner : "SomeHacker"
year : "2017"
year : "2018"
3 changes: 2 additions & 1 deletion _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<span>
<b>{{ site.owner}}</b>
</span>
<span>© {{ site.year }}</span>
{% capture currentyear %}{{ 'now' | date: "%Y" }}{% endcapture %}
<span>© {{ currentyear }}</span>
</a>
</footer>
43 changes: 26 additions & 17 deletions archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,31 @@ title: Archive
---

<section>
<h3>This year's posts</h3>
{%for post in site.posts %}
{% unless post.next %}
<ul>
{% else %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% if year != nyear %}
</ul>
<h3>{{ post.date | date: '%Y' }}</h3>
<ul>
{% endif %}
{% endunless %}
<li><time>{{ post.date | date:"%d %b" }} - </time><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</section>
{% if site.posts[0] %}

{% capture currentyear %}{{ 'now' | date: "%Y" }}{% endcapture %}
{% capture firstpostyear %}{{ site.posts[0].date | date: '%Y' }}{% endcapture %}
{% if currentyear == firstpostyear %}
<h3>This year's posts</h3>
{% else %}
<h3>{{ firstpostyear }}</h3>
{% endif %}

{%for post in site.posts %}
{% unless post.next %}
<ul>
{% else %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% if year != nyear %}
</ul>
<h3>{{ post.date | date: '%Y' }}</h3>
<ul>
{% endif %}
{% endunless %}
<li><time>{{ post.date | date:"%d %b" }} - </time><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>

{% endif %}
</section>

0 comments on commit 489b4c6

Please sign in to comment.