-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtag.html
70 lines (63 loc) · 1.85 KB
/
tag.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
---
layout: default
title: Tag
---
{% comment %}
=======================
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 post in site.posts %}
{% assign ttags = post.tags | 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:'|' %}
{% endunless %}
{% endif %}
{% endfor %}
<div class="tags-expo">
<!-- tag cloud itself -->
<div class="tags-expo-list">
{% assign tags = site.tags | sort %}
{% for tag in tags %}
<span class="site-tag">
<a href="#{{ tag | first | slugify }}"
style="font-size: {{ tag | last | size | times: 4 | plus: 80 }}%">
{{ tag[0] | replace:'-', ' ' }} ({{ tag | last | size }})
</a>
</span>
{% endfor %}
</div>
<p> </p>
<hr/>
<p> </p>
<div class="tags-expo-section">
{% for tag in site.tags %}
<h1 id="{{ tag[0] | slugify }}">{{ tag[0] }}</h1>
<ul class="tags-expo-posts">
{% for post in tag[1] %}
<a class="post-title" href="{{ site.baseurl }}{{ post.url }}">
<li style="font-size: 50%; line-height: 25px;">
{{ post.title }}
<small class="post-date">{{ post.date | date_to_string }}</small>
</li>
</a>
{% endfor %}
</ul>
{% endfor %}
</div>
</div>