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
parent546fb9345bd722cf46bd1b705b22ae839d9684e2 (diff)
feat: add webfonts & minify css/js & support basic highlight short codefeat-optimization
-rw-r--r--README.md20
-rw-r--r--assets/avatar.png (renamed from static/avatar.png)bin13954 -> 13954 bytes
-rw-r--r--assets/css/style.css (renamed from static/css/style.css)46
-rw-r--r--assets/donate/alipayimg.png (renamed from static/donate/alipayimg.png)bin59289 -> 59289 bytes
-rw-r--r--assets/donate/wechatpayimg.png (renamed from static/donate/wechatpayimg.png)bin34837 -> 34837 bytes
-rw-r--r--assets/favicon.ico (renamed from static/favicon.ico)bin1150 -> 1150 bytes
-rw-r--r--assets/js/application.js (renamed from static/js/application.js)0
-rw-r--r--assets/js/application.min.js (renamed from static/js/application.min.js)0
-rw-r--r--assets/js/insight.js (renamed from static/js/insight.js)0
-rw-r--r--assets/js/jquery.min.js (renamed from static/js/jquery.min.js)0
-rw-r--r--assets/js/plugin.js (renamed from static/js/plugin.js)0
-rw-r--r--assets/js/plugin.js.map (renamed from static/js/plugin.js.map)0
-rw-r--r--assets/js/plugin.min.js (renamed from static/js/plugin.min.js)0
-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
-rw-r--r--static/fonts/FiraCode-Retina.woffbin0 -> 145500 bytes
-rw-r--r--static/fonts/SourceHanSans-Normal.woffbin0 -> 5156 bytes
24 files changed, 114 insertions, 65 deletions
diff --git a/README.md b/README.md
index 5b1506f..a29002b 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,26 @@ The file structure of `repo` is roughly referred to [hexo-theme-pure](https://gi
4. [2019-12-24] support pagination
+5. [2019-12-31]
+ 1. support highlight shortcode Note: Just compatible with basic `highlight` usage like:
+
+ ```html
+ {{< highlight go >}}
+ // ... code
+ {{< / highlight >}}
+ ```
+
+ If you use hugo official example like,rendering will be very ugly.I don't want to compatible with it or maybe you want. Don't forget send a pr~ thanks.
+ ```html
+ {{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}}
+ // ... code
+ {{< / highlight >}}
+ ```
+
+ 2. Add my favorite font: FiraCode. If you don't like it, please fork theme and remove it under `static/font` directory.
+ 3. Add Chinese Friendly Font.
+ 4. Minify css&js file.
+
## Screenshots
![](https://raw.githubusercontent.com/xiaoheiAh/hugo-theme-pure/master/images/grey.png)
diff --git a/static/avatar.png b/assets/avatar.png
index 2ae4994..2ae4994 100644
--- a/static/avatar.png
+++ b/assets/avatar.png
Binary files differ
diff --git a/static/css/style.css b/assets/css/style.css
index 02930ad..06944cf 100644
--- a/static/css/style.css
+++ b/assets/css/style.css
@@ -7,7 +7,15 @@
/**
* font family
*/
+ @font-face {
+ font-family: Fira Code;
+ src: url("../fonts/FiraCode-Retina.woff");
+}
+@font-face {
+ font-family: Source Han Sans;
+ src: url("../fonts/SourceHanSans-Normal.woff");
+}
/**
*
*/
@@ -27,7 +35,7 @@
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
html {
- font-family: sans-serif;
+ font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif,"Fira Code","Source Han Sans";
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
@@ -148,7 +156,7 @@ code,
kbd,
pre,
samp {
- font-family: monospace, monospace;
+ font-family: "Fira Code","Source Han Sans";
font-size: 1em;
}
@@ -2940,8 +2948,7 @@ button.close {
position: absolute;
z-index: 1070;
display: block;
- font-family: "PingHei", "PingFang SC", Helvetica Neue, "Work Sans",
- "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif;
+ font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif,"Fira Code","Source Han Sans";
font-style: normal;
font-weight: normal;
letter-spacing: normal;
@@ -3258,8 +3265,7 @@ body {
body {
padding-right: 0 !important;
- font-family: "PingHei", "PingFang SC", Helvetica Neue, "Work Sans",
- "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif;
+ font-family: "Source Han Sans","Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif,"Fira Code";
font-size: 14px;
line-height: 1.57143;
color: #333333;
@@ -5600,9 +5606,8 @@ pre .js .function {
color: #8959a8;
}
-pre,
-.highlight {
- background: #fafafa;
+pre {
+ background: #fafafa !important;
margin: 10px 0;
padding: 15px 10px;
overflow: auto;
@@ -5610,11 +5615,11 @@ pre,
color: #4d4d4c;
line-height: 1.5;
}
-
+/*
.highlight .gutter pre,
.gist .gist-file .gist-data .line-numbers {
color: #666;
-}
+} */
code {
text-shadow: 0 1px #fff;
@@ -5660,7 +5665,7 @@ pre:before {
top: 0;
left: 0;
right: 0;
- background-color: #f6f6f6;
+ background-color: #f6f6f6 !important;
padding: 0 10px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
@@ -5679,8 +5684,10 @@ pre:after {
-webkit-box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
}
-
.highlight pre {
+ background-color: inherit;
+}
+/* .highlight pre {
border: none;
margin: 0;
}
@@ -5729,7 +5736,7 @@ pre:after {
padding-right: 0;
padding-left: 0;
color: #ccc;
-}
+} */
/*
* Sidebar
@@ -7044,7 +7051,7 @@ body.okayNav-loaded {
.donate-box .donate-head:before,
.donate-box .donate-head:after {
- font-family: Arial, Helvetica, sans-serif;
+ font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif,"Fira Code","Source Han Sans";
background: none;
width: 0px;
height: 0px;
@@ -7134,8 +7141,7 @@ body.okayNav-loaded {
box-sizing: border-box;
padding: 12px 28px 12px 20px;
border-bottom: 1px solid #e2e2e2;
- font-family: "Microsoft Yahei Light", "Microsoft Yahei", Helvetica, Arial,
- sans-serif;
+ font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif,"Fira Code","Source Han Sans";
}
.ins-close {
@@ -9432,10 +9438,4 @@ body.okayNav-loaded {
.navbar-fixed-bottom .navbar-collapse {
max-height: 200px;
}
-}
-
-/* Assures listing in categories indentiation is consistent */
-time {
- width: 10ch;
- display: inline-block;
} \ No newline at end of file
diff --git a/static/donate/alipayimg.png b/assets/donate/alipayimg.png
index 551d699..551d699 100644
--- a/static/donate/alipayimg.png
+++ b/assets/donate/alipayimg.png
Binary files differ
diff --git a/static/donate/wechatpayimg.png b/assets/donate/wechatpayimg.png
index 460b6b0..460b6b0 100644
--- a/static/donate/wechatpayimg.png
+++ b/assets/donate/wechatpayimg.png
Binary files differ
diff --git a/static/favicon.ico b/assets/favicon.ico
index e9e5a07..e9e5a07 100644
--- a/static/favicon.ico
+++ b/assets/favicon.ico
Binary files differ
diff --git a/static/js/application.js b/assets/js/application.js
index 66a54b5..66a54b5 100644
--- a/static/js/application.js
+++ b/assets/js/application.js
diff --git a/static/js/application.min.js b/assets/js/application.min.js
index bcdb6ee..bcdb6ee 100644
--- a/static/js/application.min.js
+++ b/assets/js/application.min.js
diff --git a/static/js/insight.js b/assets/js/insight.js
index 1981f60..1981f60 100644
--- a/static/js/insight.js
+++ b/assets/js/insight.js
diff --git a/static/js/jquery.min.js b/assets/js/jquery.min.js
index 07c00cd..07c00cd 100644
--- a/static/js/jquery.min.js
+++ b/assets/js/jquery.min.js
diff --git a/static/js/plugin.js b/assets/js/plugin.js
index 08f3c90..08f3c90 100644
--- a/static/js/plugin.js
+++ b/assets/js/plugin.js
diff --git a/static/js/plugin.js.map b/assets/js/plugin.js.map
index 9096ef8..9096ef8 100644
--- a/static/js/plugin.js.map
+++ b/assets/js/plugin.js.map
diff --git a/static/js/plugin.min.js b/assets/js/plugin.min.js
index e6bdb16..e6bdb16 100644
--- a/static/js/plugin.min.js
+++ b/assets/js/plugin.min.js
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({
diff --git a/static/fonts/FiraCode-Retina.woff b/static/fonts/FiraCode-Retina.woff
new file mode 100644
index 0000000..b387e83
--- /dev/null
+++ b/static/fonts/FiraCode-Retina.woff
Binary files differ
diff --git a/static/fonts/SourceHanSans-Normal.woff b/static/fonts/SourceHanSans-Normal.woff
new file mode 100644
index 0000000..cb21af1
--- /dev/null
+++ b/static/fonts/SourceHanSans-Normal.woff
Binary files differ