-
Notifications
You must be signed in to change notification settings - Fork 3
/
list-purposes.html
75 lines (69 loc) · 2.34 KB
/
list-purposes.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
layout: page
title: List of Purposes
---
{% comment %}
https://codinfox.github.io/dev/2015/03/06/use-tags-and-categories-in-your-jekyll-based-github-pages/
=======================
The following part extracts all the tags from your posts and sort tags, so that you do not need to manually collect your tags to a place.
=======================
{% endcomment %}
{% assign rawtags = "" %}
{% for text in site.texts %}
{% assign ttags = text.purposes | join:'|' | append:'|' %}
{% assign rawtags = rawtags | append:ttags %}
{% endfor %}
{% assign rawtags = rawtags | split:'|' | sort %}
{% comment %}
=======================
The following part removes dulpicated tags and invalid tags like blank tag.
=======================
{% endcomment %}
{% assign tags = "" %}
{% for tag in rawtags %}
{% if tag != "" %}
{% if tags == "" %}
{% assign tags = tag | split:'|' %}
{% endif %}
{% unless tags contains tag %}
{% assign tags = tags | join:'|' | append:'|' | append:tag | split:'|' | sort %}
{% endunless %}
{% endif %}
{% endfor %}
{% comment %}
=======================
The purpose of this snippet is to list all the tags you have in your site.
=======================
{% endcomment %}
{% for tag in tags %}
<a class="tag" href="#{{ tag | slugify }}"><span class="post-tag-2"> {{ tag }} </span></a>
{% endfor %}
{% comment %}
=======================
The purpose of this snippet is to list all your posts posted with a certain tag.
=======================
{% endcomment %}
{% for tag in tags %}
<h3 id="{{ tag | slugify }}">{{ tag }}</h3>
<ul>
{% for text in site.texts %}
{% if text.purposes contains tag %}
<li>
<p>
<a href="{{ site.baseurl }}/texts/{{ text.identifier }}">
{{ text.title }}
</a>
<small>- {{ text.folio }}</small>
<br/>
{% for tag in text.purposes %}
<a class="tag small" href="#{{ tag | slugify }}"><span class="post-tag-2"> {{ tag }} </span></a>
{% endfor %}
{% for activity in text.activities %}
<a class="tag small" href="{{ site-baseurl }}/GR8975-edition/list-activities#{{ activity | slugify }}"><span class="post-tag"> {{ activity }} </span></a>
{% endfor %}
</p>
</li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}