-
Notifications
You must be signed in to change notification settings - Fork 2
/
tag.html
83 lines (73 loc) · 2.48 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
71
72
73
74
75
76
77
78
79
80
81
82
---
layout: document
title: Tag
permalink: /tag/
public: true
---
<h6>이곳에 보이는 태그는 <a href="https://stackoverflow.com/tags?tab=popular">stackoverflow tag 페이지</a> 에서 인기도가 높은 태그를 우선으로 선정했습니다.</h6>
{% assign tagMap = site.data.tagMap %}
{% assign tagList = site.data.tagList %}
<div>
<ul class="tag-list">
{% for tag in tagList %}
<li>
<a href="#{{tag}}" onclick="showTag('#{{tag}}')">
{{tag}}<sup>{{ tagMap[tag] | size }}</sup>
</a>
</li>
{% endfor %}
</ul>
</div>
<div>
{% for tag in tagList %}
<div class="archive-group invisible" id="{{tag}}">
<h3 id="{{tag}}">#{{ tag }}</h3>
<ul class="post-list leaders">
{% assign list = tagMap[tag] %}
{% for postObj in list %}
{% assign post = site.data.pageMap[postObj.fileName] %}
{% if post.public != false %}
<li>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">
<span>{{ post.title }}</span>
<div class="post-meta" style="float: right;">
{{ post.updated | date: "%Y.%m.%d" }}
</div>
{% if post.summary != empty and post.summary != undefined %}
<div class="post-excerpt">
- {{ post.summary }}
</div>
{% endif %}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
<h3 id="stackoverflow">Checking ... "#{{ tag }}" in StackOverflow</h3>
</div>
{% endfor %}
</div>
<script src="../js/axios.min.js"></script>
<script src="../js/taginstackoverflow.js"></script>
<script>
function showTag(selector) {
document.querySelectorAll('.visible')
.forEach(function(el) {
el.classList.remove('visible');
el.classList.add('invisible');
})
var list = document.querySelector(selector);
list.classList.add('visible');
list.classList.remove('invisible');
const onlyTagString = selector.slice(1)
document.dispatchEvent(new CustomEvent('showtag', { detail: onlyTagString }));
}
;(function showInitTag() {
const url = window.location.href;
const req = /#([^\s]+)$/.exec(url);
if(Array.isArray(req)) {
var selector = '#' + decodeURI(req.pop());
showTag(selector);
}
})();
</script>