Refine navbar

Add year subtitles automatically and remove need for categories on posts
This commit is contained in:
Matthew Grove
2019-02-05 08:11:59 +00:00
parent 54dd7f9f34
commit e98316f947
2 changed files with 8 additions and 4 deletions

View File

@@ -12,13 +12,18 @@
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">home</i>
<span class="mdc-list-item__text">Home Page</span>
</a>
{% if site.categories.articles %}
{% if site.posts %}
<div class="mdc-list-group">
<h3 class="mdc-list-group__subheader">Articles</h3>
{% for page in site.categories.articles %}
{% for article in site.posts %}
{% assign currentdate = article.date | date: "%Y" %}
{% if currentdate != date %}
<h3 class="mdc-list-group__subheader">{{ currentdate }}</h3>
{% assign date = currentdate %}
{% endif %}
<a class="mdc-list-item" href="{{ page.url | relative_url }}" data-mdc-auto-init="MDCRipple">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">assignment</i>
<span class="mdc-list-item__text">{{ page.title }}</span>
<span class="mdc-list-item__text">{{ article.title }}</span>
</a>
{% endfor %}
</div>