-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtag.html
47 lines (46 loc) · 1.94 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
---
layout: default
title: "标签"
is_tag: true
---
<!-- Bootstrapt 5 completed -->
{% capture tags %}
{% for tag in site.tags %}
{{ tag[1].size | plus: 1000 }}#{{ tag[0] }}#{{ tag[1].size }}
{% endfor %}
{% endcapture %}
{% assign sortedtags = tags | split:' ' | sort %}
<ul class="ps-0 mb-4" role="tablist">
{% for tag in sortedtags reversed %}
{% assign tagitems = tag | split: '#' %}
<li role="presentation" class="d-inline-block">
<a id="pills-{{ tagitems[1] }}-tab" href="#list_{{ tagitems[1] }}" title="{{ tagitems[1] }}" data-bs-toggle="pill" data-bs-target="#pills-{{ tagitems[1] }}" role="tab" aria-controls="pills-{{ tagitems[1] }}" aria-selected="false"><span class="badge text-bg-primary">{{ tagitems[1] }} <sup>{{ tagitems[2] }}</sup></span></a>
</li>
{% endfor %}
</ul>
<div class="tab-content text-nowrap overflow-x-auto">
{% for tag in site.tags %}
<div class="tab-pane fade" id="pills-{{ tag[0] }}" role="tabpanel" aria-labelledby="pills-{{ tag[0] }}-tab" tabindex="0">
<table class="table table-striped">
<tbody>
{% for post in tag[1] %}
<tr>
<td><a class="link-underline link-underline-opacity-0 link-underline-opacity-100-hover" href="{{ site.url }}{{ post.url }}">{{ post.title }}</a></td>
<td class="fw-bold">
<i data-feather="calendar"></i>{{ post.date | date: "%Y-%m-%d"}}
</td>
<td class="text-center">
{% for cat in post.categories %}
<i data-feather="folder"></i><a class="link-underline link-underline-opacity-0 link-underline-opacity-100-hover" href="/type#{{ cat }}">{{ cat }}</a>
{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
</div>
<script type="text/javascript">
const triggerTabList = document.querySelectorAll("#pills-" + decodeURI(location.hash.replace("#","")) + "-tab")
triggerTabList.forEach(triggerEl => {new bootstrap.Tab(triggerEl).show();})
</script>