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:
authoryunxiang.zhao <xiaohei.zyx@gmail.com>2021-01-13 09:44:33 +0300
committerGitHub <noreply@github.com>2021-01-13 09:44:33 +0300
commitc97723a02ac3abace65a6433eab381f0acbe2719 (patch)
treefb02a8e47b0ddeb94e66c37c8f429d0e56460e29
parent1f8caf73d499fceb8955e1456e56e44eca1e8125 (diff)
parent533e10b2ee02341b3c233e67a08264bec7a46ba8 (diff)
Merge pull request #96 from miska/master
Various fixes and features
-rw-r--r--exampleSite/config.yml6
-rw-r--r--i18n/en.yaml9
-rw-r--r--layouts/index.html2
-rw-r--r--layouts/partials/_widgets/tag_cloud.html33
-rw-r--r--layouts/partials/article.html6
-rw-r--r--layouts/partials/post/copyright.html9
6 files changed, 59 insertions, 6 deletions
diff --git a/exampleSite/config.yml b/exampleSite/config.yml
index dfaf0a5..57389cf 100644
--- a/exampleSite/config.yml
+++ b/exampleSite/config.yml
@@ -1,6 +1,7 @@
baseURL: https://example.com/
theme: pure
title: Pure theme for Hugo
+copyright: CC BY 4.0 CN
defaultContentLanguage: en # en/zh/...
footnoteReturnLinkContents: ↩
hasCJKLanguage: true
@@ -67,6 +68,7 @@ params:
since: 2017
dateFormatToUse: "2006-01-02"
enablePostCopyright: true
+ copyright_link: http://creativecommons.org/licenses/by/4.0/deed.zh
# the directory under content folder that you want to render
mainSections: ["posts"]
# Enable/Disable menu icons
@@ -75,6 +77,9 @@ params:
highlightjs:
langs: ["python", "javascript"] # refer to http://staticfile.org/, search highlight.js, already have highlight.min.js
+ tag_cloud:
+ min: 8
+ max: 20
# Allows you to specify an override stylesheet
# put custom.css in $hugo_root_dir/static/
# customCSS: css/custom.css
@@ -192,6 +197,7 @@ params:
# Sidebar only the following widgets. you can remove any you don't like it.
widgets:
- board
+ - tag_cloud
- category
- tag
- recent_posts
diff --git a/i18n/en.yaml b/i18n/en.yaml
index a9d3d0c..130ec2d 100644
--- a/i18n/en.yaml
+++ b/i18n/en.yaml
@@ -79,14 +79,14 @@ insight_untitled:
unit_word:
- other: words
+ other: " words"
unit_time:
- other: minutes
+ other: " minutes"
article_wordcount:
other: "Word Count: "
article_readcount:
- other: "Read Count: "
+ other: "Read Time: "
article_more:
other: Read More
article_comments:
@@ -97,12 +97,15 @@ article_catalogue:
other: Catalogue
total_article:
+ one: Total {{ .Count }} article
other: Total {{ .Count }} articles
total_tag:
other: Total {{ .Count }} tags
total_category:
+ one: Total {{ .Count }} category
other: Total {{ .Count }} categories
total_link:
+ other: Total {{ .Count }} link
other: Total {{ .Count }} links
total_repository:
other: Total {{ .Count }} projects
diff --git a/layouts/index.html b/layouts/index.html
index 6cd7fd6..35481f0 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -29,7 +29,9 @@
{{- partial "post/date.html" . }}
{{- partial "post/category.html" . }}
{{- partial "post/tag.html" . }}
+ {{- if .Site.Params.comment.type }}
<span class="post-comment"><i class="icon icon-comment"></i> &nbsp;<a href="{{- .RelPermalink }}#comments" class="article-comment-link">{{- T "article_comments" }}</a></span>
+ {{- end }}
{{- partial "post/wc.html" . }}
</p>
</article>
diff --git a/layouts/partials/_widgets/tag_cloud.html b/layouts/partials/_widgets/tag_cloud.html
new file mode 100644
index 0000000..21b0894
--- /dev/null
+++ b/layouts/partials/_widgets/tag_cloud.html
@@ -0,0 +1,33 @@
+<div class="widget">
+ <h3 class="widget-title"> {{ T "widget_tags" }}</h3>
+ <div id="tag-cloud-list" class="widget-body">
+ {{ range $name, $taxonomy := $.Site.Taxonomies.tags }}
+ {{ with $.Site.GetPage (printf "/tags/%s" $name) }}
+ <a href="{{ .Permalink }}" class="tag-list-link" rel="{{ $taxonomy.Count}}">{{ $name }}<span
+ class="tag-list-count">{{ $taxonomy.Count}}</span></a>
+ {{ end }}
+ {{- end }}
+ </div>
+<script>
+document.onreadystatechange = () => {
+ if (document.readyState === 'complete') {
+ tagCloud('#tag-cloud-list a', {{ $.Site.Params.tag_cloud.min }}, {{ $.Site.Params.tag_cloud.max }});
+ }
+};
+
+function tagCloud(where, min, max) {
+ let iMax = 0;
+ let iMin = 0;
+ $(where).each(function() {
+ let weight = Number($(this).attr("rel"));
+ if(iMax < weight) iMax = weight;
+ if(iMin > weight || iMin == 0) iMin = weight;
+ });
+ let step = (max - min)/(iMax - iMin);
+ $(where).each(function() {
+ let weight = $(this).attr("rel") - iMin;
+ $(this).css({"font-size": min + (weight * step) + 'px'});
+ });
+};
+</script>
+</div>
diff --git a/layouts/partials/article.html b/layouts/partials/article.html
index ec979cf..ccbed3c 100644
--- a/layouts/partials/article.html
+++ b/layouts/partials/article.html
@@ -14,8 +14,10 @@
{{- partial "post/category.html" . }}
{{- partial "post/tag.html" . }}
{{- partial "post/pv.html" . }}
+ {{- if .Site.Params.comment.type }}
<span class="post-comment"><i class="icon icon-comment"></i>&nbsp;<a href="{{ .RelPermalink }}#comments"
class="article-comment-link">{{T "article_comments" }}</a></span>
+ {{- end }}
{{- partial "post/wc.html" . }}
</div>
</div>
@@ -26,7 +28,9 @@
{{- partial "post/copyright.html" . }}
</div>
</article>
+ {{- if (.Site.Params.comment.type) }}
{{- partial "post/comment.html" . }}
+ {{- end }}
</div>
{{- partial "post/nav.html" . }}
-{{- partial "post/donate.html" . }} \ No newline at end of file
+{{- partial "post/donate.html" . }}
diff --git a/layouts/partials/post/copyright.html b/layouts/partials/post/copyright.html
index e7f47ee..60495f9 100644
--- a/layouts/partials/post/copyright.html
+++ b/layouts/partials/post/copyright.html
@@ -6,7 +6,12 @@
<a href="{{- .Permalink }}" title="{{- .Title }}" target="_blank" rel="external">{{- .Permalink }}</a>
</li>
<li class="post-copyright-license">
- <strong>{{ T "copyright_license" }}:</strong><a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN</a>
+ <strong>{{ T "copyright_license" }}: </strong>
+{{- if .Site.Params.copyright_link }}
+ <a href="{{- .Site.Params.copyright_link }}" target="_blank" rel="external">{{ .Site.Copyright }}</a>
+{{- else }}
+ {{ .Site.Copyright }}
+{{- end }}
</li>
</ul>
</blockquote>
@@ -28,4 +33,4 @@
</div>
</div>
{{- end }}
-{{- end }} \ No newline at end of file
+{{- end }}