forked from barryclark/jekyll-now
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.html
58 lines (54 loc) · 1.87 KB
/
archive.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
---
layout: default
title: Archive
---
<div class="archive">
<div>
<h2>日期分类</h2>
{% for post in site.posts %}
{% capture month %}{{ post.date | date: '%m%Y' }}{% endcapture %}
{% capture next_post_month %}{{ post.next.date | date: '%m%Y' }}{% endcapture %}
{% if month != next_post_month %}
{% if forloop.index != 1 %}
</ul>
{% endif %}
<h3>{{ post.date | date: '%B %Y' }}</h3><ul>
{% endif %}
<li>
<time>{{ post.date | date: "%e %B %Y" }}</time>
<span> ... </span>
<a href="{{ post.url }}/">{{ post.title }}</a>
</li>
{% endfor %}
</div>
<div>
<h2>标签分类</h2>
{% assign tags_with_count = '' %}
{% for tag in site.tags %}
{% assign keyword = tag | first %}
{% assign count = site.tags[keyword].size %}
{% if count < 10 %}
{% assign count = count | prepend: '0' %}
{% endif %}
{% assign tags_with_count = tags_with_count | append: count | append: '=' | append: keyword %}
{% unless forloop.last %}
{% assign tags_with_count = tags_with_count | append: '|' %}
{% endunless %}
{% endfor %}
<!-- 1=jekyll|1=reading|2=js|1=source-map|1=socket|1=gulp|1=hr|1=lifestyle|1=seo|3=css|1=blend -->
{% assign tags_with_count = tags_with_count | split: '|' | sort | reverse %}
{% for tag_with_count in tags_with_count %}
{% assign tag = tag_with_count | split: '=' | last %}
<h3>#{{ tag }}</h3>
<ul>
{% for post in site.tags[tag] %}
<li>
<time>{{ post.date | date: "%e %B %Y" }}</time>
<span> ... </span>
<a href="{{ post.url }}/">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
</div>
</div>