Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xiaoheiAh/hugo-theme-pure.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotis <xiaohei.zyx@gmail.com>2019-12-31 13:33:42 +0300
committerotis <xiaohei.zyx@gmail.com>2019-12-31 13:33:42 +0300
commit882292fa66f90f43cba56818d79d61992be3d5b8 (patch)
tree5809974547c766bf95b4ea4964ace8392350fc95 /layouts
parent546fb9345bd722cf46bd1b705b22ae839d9684e2 (diff)
feat: add webfonts & minify css/js & support basic highlight short codefeat-optimization
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/list.html71
-rw-r--r--layouts/_default/list.searchindex.json2
-rw-r--r--layouts/index.html2
-rw-r--r--layouts/partials/head.html10
-rw-r--r--layouts/partials/item-post.html12
-rw-r--r--layouts/partials/post/category.html2
-rw-r--r--layouts/partials/post/date.html2
-rw-r--r--layouts/partials/post/tag.html2
-rw-r--r--layouts/partials/script.html10
9 files changed, 71 insertions, 42 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 767cbd3..a318be3 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -6,33 +6,58 @@
<p class="text-muted">{{- T "total_article" (len .Site.RegularPages) }}</p>
</header>
<div class="article-body">
+ {{- $emptyDatePages := slice}}
{{- $currentYearSection := 0}}
{{- range $idx,$page := .Site.RegularPages}}
- {{- $thisYear := $page.Date.Format ("2006") }}
- {{- if eq $currentYearSection 0 }}
- {{- $currentYearSection = $thisYear}}
- {{- end }}
- {{- if or (eq $idx 0) (ne $currentYearSection $thisYear)}}
- {{- if ne $idx 0 }}
- </div></div></div></section>
+ {{- if $page.Date}}
+ {{- $thisYear := $page.Date.Format ("2006") }}
+ {{- if eq $currentYearSection 0 }}
+ {{- $currentYearSection = $thisYear}}
+ {{- end }}
+ {{- if or (eq $idx 0) (ne $currentYearSection $thisYear)}}
+ {{- if ne $idx 0 }}
+ </div></div></div></section>
+ {{- end}}
+ <section class="panel panel-default b-no">
+ <div class="panel-heading" role="tab">
+ <h3 class="panel-title">
+ <a data-toggle="collapse" href="#collapse{{- $thisYear }}" aria-expanded="true">
+ <i class="icon icon-calendar-plus text-active"></i><i class="icon icon-calendar-minus text"></i>
+ &nbsp;{{- $thisYear }}
+ </a>
+ </h3>
+ </div>
+ <div id="collapse{{- $thisYear }}" class="panel-collapse collapse in" role="tabpanel"
+ aria-labelledby="heading{{- $thisYear }}">
+ <div class="panel-body">
+ <div class="collection">
{{- end}}
- <section class="panel panel-default b-no">
- <div class="panel-heading" role="tab">
- <h3 class="panel-title">
- <a data-toggle="collapse" href="#collapse{{- $thisYear }}" aria-expanded="true">
- <i class="icon icon-calendar-plus text-active"></i><i class="icon icon-calendar-minus text"></i>
- &nbsp;{{- $thisYear }}
- </a>
- </h3>
- </div>
- <div id="collapse{{- $thisYear }}" class="panel-collapse collapse in" role="tabpanel"
- aria-labelledby="heading{{- $thisYear }}">
- <div class="panel-body">
- <div class="collection">
- {{- end}}
- {{- .Scratch.Set "type" "link"}}
- {{- partial "item-post.html" . }}
+ {{- .Scratch.Set "type" "link"}}
+ {{- partial "item-post.html" . }}
+ {{- else}}
+ {{- $emptyDatePages = $emptyDatePages | append $page}}
+ {{- end }}
{{- end}}
+ {{- if $emptyDatePages}}
+ </div></div></div></section>
+ <section class="panel panel-default b-no">
+ <div class="panel-heading" role="tab">
+ <h3 class="panel-title">
+ <a data-toggle="collapse" href="#collapse-other" aria-expanded="true">
+ <i class="icon icon-calendar-plus text-active"></i><i class="icon icon-calendar-minus text"></i>
+ &nbsp; Other
+ </a>
+ </h3>
+ </div>
+ <div id="collapse-other" class="panel-collapse collapse in" role="tabpanel"
+ aria-labelledby="heading-other">
+ <div class="panel-body">
+ <div class="collection">
+ {{- range $page := $emptyDatePages}}
+ {{- .Scratch.Set "type" "link"}}
+ {{- partial "item-post.html" . }}
+ {{- end}}
+ {{- end }}
</div></div></div></section>
</div>
</article>
diff --git a/layouts/_default/list.searchindex.json b/layouts/_default/list.searchindex.json
index cf2f165..8106d3b 100644
--- a/layouts/_default/list.searchindex.json
+++ b/layouts/_default/list.searchindex.json
@@ -14,4 +14,4 @@
{{- $.Scratch.SetInMap "searchindex" "posts" ($.Scratch.Get "posts") }}
{{- $.Scratch.SetInMap "searchindex" "tags" ($.Scratch.Get "tags") }}
{{- $.Scratch.SetInMap "searchindex" "categories" ($.Scratch.Get "categories") }}
-{{- $.Scratch.Get "searchindex" | jsonify -}}
+{{- $.Scratch.Get "searchindex" | jsonify -}} \ No newline at end of file
diff --git a/layouts/index.html b/layouts/index.html
index 6cf9c3a..0a8197c 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -25,7 +25,7 @@
{{- partial "post/date.html" . }}
{{- partial "post/category.html" . }}
{{- partial "post/tag.html" . }}
- <span class="post-comment"><i class="icon icon-comment"></i> <a href="{{- .RelPermalink }}#comments" class="article-comment-link">{{- T "article_comments" }}</a></span>
+ <span class="post-comment"><i class="icon icon-comment"></i> &nbsp;<a href="{{- .RelPermalink }}#comments" class="article-comment-link">{{- T "article_comments" }}</a></span>
{{- partial "post/wc.html" . }}
</p>
</article>
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 3119aec..3b33df5 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -50,13 +50,13 @@
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
-
- <link rel="stylesheet" href="{{ "css/style.css" | absURL }}">
- <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css">
+ {{ $css := resources.Get "css/style.css" | minify | fingerprint}}
+ <link rel="stylesheet" href="{{ $css.Permalink }}">
+ <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css" async>
{{- if eq .Site.Params.comment.type "gitalk"}}
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css" async>
{{- end }}
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css">
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css" async>
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/spf13/hugo/blob/master/tpl/tplimpl/template_embedded.go#L158 */}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/google_news.html" . -}}
diff --git a/layouts/partials/item-post.html b/layouts/partials/item-post.html
index cc289d2..6acd9e2 100644
--- a/layouts/partials/item-post.html
+++ b/layouts/partials/item-post.html
@@ -1,8 +1,8 @@
-<a href="{{- .Permalink }}" class="collection-item" itemprop="url" target="_blank" >
- <time datetime="{{ .Date }}"
- itemprop="datePublished">
- {{ if .Date }}
+<a href="{{- .Permalink }}" class="collection-item" itemprop="url" target="_blank">
+ {{- if .Date }}
+ <time datetime="{{ .Date }}" itemprop="datePublished">
{{- .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
- {{ end }}</time>
- <span>&nbsp;&nbsp;&nbsp;</span> {{- .Title }}
+ </time>
+ {{- end }}
+ {{- .Title }}
</a> \ No newline at end of file
diff --git a/layouts/partials/post/category.html b/layouts/partials/post/category.html
index 2a49f04..bd06f49 100644
--- a/layouts/partials/post/category.html
+++ b/layouts/partials/post/category.html
@@ -1,6 +1,6 @@
{{- with .Params.categories -}}
<span class="article-category">
- <i class="icon icon-folder"></i>
+ <i class="icon icon-folder"></i>&nbsp;
{{- range . }}
<a class="article-category-link" href="{{ "categories" | relLangURL }}/{{ . | urlize }}/"> {{ . }} </a>
{{- end}}
diff --git a/layouts/partials/post/date.html b/layouts/partials/post/date.html
index b440287..b519b55 100644
--- a/layouts/partials/post/date.html
+++ b/layouts/partials/post/date.html
@@ -1,6 +1,6 @@
{{ if .Date }}
<span class="article-date">
- <i class="icon icon-calendar-check"></i>
+ <i class="icon icon-calendar-check"></i>&nbsp;
<a href="{{- .Permalink }}" class="{{ .Scratch.Get "class_name" }}">
<time datetime="{{ .Date }}" itemprop="datePublished">{{- .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</time>
</a>
diff --git a/layouts/partials/post/tag.html b/layouts/partials/post/tag.html
index de641bc..1c5b7d6 100644
--- a/layouts/partials/post/tag.html
+++ b/layouts/partials/post/tag.html
@@ -1,6 +1,6 @@
{{- with .Params.tags}}
<span class="article-tag">
- <i class="icon icon-tags"></i>
+ <i class="icon icon-tags"></i>&nbsp;
{{- range . }}
<a class="article-tag-link" href="{{ "tags" | relLangURL }}/{{ . | urlize }}/"> {{ . }} </a>
{{- end}}
diff --git a/layouts/partials/script.html b/layouts/partials/script.html
index 9ff925c..ec8f898 100644
--- a/layouts/partials/script.html
+++ b/layouts/partials/script.html
@@ -17,8 +17,11 @@
})
hljs.initHighlightingOnLoad();
</script>
-<script type="text/javascript" src="{{ "js/application.js" | absURL }}"></script>
-<script type="text/javascript" src="{{ "js/plugin.js" | absURL }}"></script>
+{{- $appjs := resources.Get "js/application.js" | resources.Minify | resources.Fingerprint}}
+<script src="{{- $appjs.Permalink }}"></script>
+{{- $plugin := resources.Get "js/plugin.js" | resources.Minify | resources.Fingerprint}}
+<script src="{{- $plugin.Permalink }}"></script>
+
<script>
(function (window) {
var INSIGHT_CONFIG = {
@@ -35,7 +38,8 @@
window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
-<script type="text/javascript" src="{{ "js/insight.js" | absURL }}"></script>
+{{- $insight := resources.Get "js/insight.js" | resources.Minify | resources.Fingerprint "sha512" }}
+<script type="text/javascript" src="{{- $insight.Permalink }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script>
<script>
tocbot.init({