-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcategories.html
36 lines (35 loc) · 1.21 KB
/
categories.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
title: Posts by categories
description: "An archive of posts sorted by categories"
layout: default
excerpt: The list of categories on the personal website of Peter Solymos.
---
{% capture site_tags %}{% for tag in site.categories %}{{ tag | first }}{%
unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %} {% assign
tag_words = site_tags | split:',' | sort %}
<p>
{% for tag in tag_words) %}
<a href="#{{ tag | slugify }}" class="btn btn-default btn-xs"
>{{ tag }} <span>({{ site.categories[tag] | size }})</span></a
>
{% endfor %}
</p>
<hr />
{% for item in (0..site.categories.size) %}{% unless forloop.last %} {% capture
this_word %}{{ tag_words[item] | strip_newlines }}{% endcapture %}
<h2 id="{{ this_word | slugify }}">{{ this_word }}</h2>
<ul class="list-unstyled">
{% for post in site.categories[this_word] %}{% if post.title != null %}
<li itemscope>
<span class="entry-date"
><time
datetime="{{ post.date | date_to_xmlschema }}"
itemprop="datePublished"
>{{ post.date | date: "%B %d, %Y" }}</time
></span
>
— <a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
</li>
{% endif %}{% endfor %}
</ul>
{% endunless %}{% endfor %}