blob: d69fd3a9c26b4d2cfe79459999b0df9e0e9a8519 (
plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
<article class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
{{ if .Title }}
<header class="article-header">
<h1 class="article-title" itemprop="name">{{ .Title }}</h1>
</header>
{{ end }}
<div class="article-meta">
{{- if not .Params.omitDate }}
<a href="{{ .RelPermalink }}" class="article-date">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05.000-07:00" }}' itemprop="datePublished">{{ .Date.Format "2006-01-02" }}</time>
</a>
{{ end -}}
{{ $Site := .Site }}
{{ if .Params.categories }}
<div class="post-categories">
<div class="article-category">
{{ range $i, $e := .Params.categories }}
{{ if gt $i 0 }}
<span>></span>
{{ end }}
<a class="article-category-link" href="{{ $Site.BaseURL }}/categories/{{ $e | urlize }}">{{ $e }}</a>
{{ end }}
</div>
</div>
{{ end }}
{{ if .Site.DisqusShortname }}
<div class="article-comment-link-wrap">
<a href="{{ .RelPermalink }}#disqus_thread" class="article-comment-link">Comments</a>
</div>
{{ end }}
</div>
<div class="article-entry" itemprop="articleBody">
{{ .Content }}
</div>
{{ if not .Params.notoc }}
{{ if .TableOfContents }}
<div class="article-toc" {{ if .Site.Params.SmartToc }}style="display:none;"{{ end }}>
<h3>{{ T "Contents" }}</h3>
{{ .TableOfContents }}
</div>
{{ end }}
{{ end }}
{{ if .Site.Params.SmartToc }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js" integrity="sha256-/SIrNqv8h6QGKDuNoLGA4iret+kyesCkHGzVUUV0shc=" crossorigin="anonymous"></script>
<script>
(function() {
var $toc = $('#TableOfContents');
if ($toc.length > 0) {
var $window = $(window);
function onScroll(){
var currentScroll = $window.scrollTop();
var h = $('.article-entry h1, .article-entry h2, .article-entry h3, .article-entry h4, .article-entry h5, .article-entry h6');
var id = "";
h.each(function (i, e) {
e = $(e);
if (e.offset().top - 10 <= currentScroll) {
id = e.attr('id');
}
});
var active = $toc.find('a.active');
if (active.length == 1 && active.eq(0).attr('href') == '#' + id) return true;
active.each(function (i, e) {
$(e).removeClass('active').siblings('ul').hide();
});
$toc.find('a[href="#' + id + '"]').parentsUntil('#TableOfContents').each(function (i, e) {
$(e).children('a').addClass('active').siblings('ul').show();
});
}
$window.on('scroll', onScroll);
$(document).ready(function() {
$toc.find('a').parent('li').find('ul').hide();
onScroll();
document.getElementsByClassName('article-toc')[0].style.display = '';
});
}
})();
</script>
{{ end }}
{{ if .Params.tags }}
<footer class="article-footer">
<ul class="article-tag-list">
{{ range .Params.tags }}
<li class="article-tag-list-item">
<a class="article-tag-list-link" href="{{ $Site.BaseURL}}/tags/{{ . | urlize }}">{{ . }}
</a>
</li>
{{ end }}
</ul>
</footer>
{{ end }}
</div>
{{ partial "nav.html" . }}
</article>
|