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

github.com/MeiK2333/github-style.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaxleof <moonandxinxin@qq.com>2022-06-23 11:37:04 +0300
committerjaxleof <moonandxinxin@qq.com>2022-06-23 11:37:04 +0300
commit66042aa6aa913fac7474e6f8edf5b5b217a849f1 (patch)
tree8433c8d4f6620457521682ddff4b3d70ab4fb094
parentbc08dd6354846518b2b90e93329a888c2f9b98a6 (diff)
feat: Add tag-based classification
-rw-r--r--layouts/partials/posts.html4
-rw-r--r--layouts/partials/tags.html19
2 files changed, 23 insertions, 0 deletions
diff --git a/layouts/partials/posts.html b/layouts/partials/posts.html
index 2792b93..f8d0e4d 100644
--- a/layouts/partials/posts.html
+++ b/layouts/partials/posts.html
@@ -21,6 +21,10 @@
</a>
</div>
</div>
+ {{else}}
+ {{if gt (len .Site.Taxonomies.tags) 0}}
+ {{partial "tags.html" .}}
+ {{end}}
{{ end }}
<ul>
{{ range .Paginator.Pages }}
diff --git a/layouts/partials/tags.html b/layouts/partials/tags.html
new file mode 100644
index 0000000..d4eaed4
--- /dev/null
+++ b/layouts/partials/tags.html
@@ -0,0 +1,19 @@
+<style>
+ .tags{
+ padding: 15px 0;
+ }
+</style>
+<div class="f6 text-gray mt-2 tags border-bottom">
+ {{range $taxonomyname, $taxonomy := .Site.Taxonomies}}
+ {{range $key, $value := $taxonomy }}
+ <a class="muted-link mr-3" href="{{ relURL (print "tags/" $key) }}/">
+ <svg class="octicon octicon-tag" viewBox="0 0 16 16" version="1.1" width="16" height="16">
+ <path fill-rule="evenodd"
+ d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z">
+ </path>
+ </svg>
+ {{$key}}
+ </a>
+ {{end}}
+ {{end}}
+</div> \ No newline at end of file