From 88fb497815279a64bbfe38e7cdd1676a2b683b77 Mon Sep 17 00:00:00 2001 From: zilch40 Date: Sun, 15 Nov 2020 18:24:58 +0800 Subject: modify taxonomy related pages && archive pages --- README.md | 9 ++++-- assets/css/common.scss | 11 ++----- i18n/en.toml | 9 ------ i18n/zh-cn.toml | 9 ------ layouts/_default/taxonomy.html | 69 +++++++++++++++++++++++++++--------------- layouts/_default/term.html | 58 +++++++++++++++++++++++++++++++++++ layouts/archives/single.html | 63 ++++++++++++++++---------------------- layouts/partials/nav.html | 2 +- layouts/partials/posts.html | 23 ++++++++------ 9 files changed, 150 insertions(+), 103 deletions(-) create mode 100644 layouts/_default/term.html diff --git a/README.md b/README.md index 91055d8..45450b1 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,15 @@ [Demo site](https://v4.zilch40.wang) +[My Blog](https://blog.zilch40.wang) + ## Features - small & fast - basic functions: - - category & tag - - archives + - category list&term pages + - tag list&term pages + - archives pages - TOC sidebar - `prefers-color-scheme` media support @@ -58,7 +61,7 @@ theme = "hulga" # enable katex rendering math = true - # enable postcss, mainly for css purge (119kB->16kB->4kB gzipped, but this makes build slower) + # enable postcss, mainly for css purge (129kB->20kB->4.8kB gzipped, but this makes build slower) postcss = true # enable toc on post page diff --git a/assets/css/common.scss b/assets/css/common.scss index 19b2665..05e63b9 100644 --- a/assets/css/common.scss +++ b/assets/css/common.scss @@ -6,7 +6,8 @@ @import "../sass/elements/title"; @import "../sass/elements/tag"; @import "../sass/elements/box"; -// @import "../sass/form/_all"; +@import "../sass/form/shared"; +@import "../sass/form/tools"; @import "../sass/components/breadcrumb"; @import "../sass/components/navbar"; @import "../sass/components/pagination"; @@ -88,14 +89,6 @@ a { } /*category and tags*/ -.mytag { - background: transparent !important; - border: solid 2px; - font-size: 1rem !important; -} -.mytag a { - color: currentColor; -} .post-tag { margin-right: 0.5em; } diff --git a/i18n/en.toml b/i18n/en.toml index 1fcae9e..c6d1075 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -4,15 +4,6 @@ other = "Categories" [tags] other = "Tags" -[taxo_cat_before] -other = "Articles with category " - -[taxo_tag_before] -other = "Articles with tag " - -[taxo_after] -other = "" - [prev_page] other = "Previous" diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml index b7c786e..551b33b 100644 --- a/i18n/zh-cn.toml +++ b/i18n/zh-cn.toml @@ -4,15 +4,6 @@ other = "分类" [tags] other = "标签" -[taxo_cat_before] -other = "分类 " - -[taxo_tag_before] -other = "标签 " - -[taxo_after] -other = " 中的文章" - [prev_page] other = "上一页" diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index fba4a8f..5344be9 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -1,40 +1,59 @@ {{ define "main" }} -{{- partial "header.html" . -}} - +{{ partial "header.html" . }}
-
- {{ if eq .Data.Singular "category" }} -

- {{- i18n "taxo_cat_before" -}} - {{ .Data.Term }} - {{- i18n "taxo_after" -}} -

- {{ else if eq .Data.Singular "tag" }} -

- {{- i18n "taxo_tag_before" -}} - {{ .Data.Term }} - {{- i18n "taxo_after" -}} -

- {{ end }} + {{ if eq .Data.Singular "category" }} +
+
+

+ {{ i18n "categories" }} +

+
+
+
+ {{ range .Site.Taxonomies.categories.ByCount }} +
+ {{ .Name }} + + {{ .Count }} + +
+ {{ end }} +
+
-
- {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} - {{ range $paginator.Pages }} -
-
{{ .Date.Format "2006/01/02" }}
- +
+ {{ end }} + + {{ if eq .Data.Singular "tag" }} +
+
+

+ {{ i18n "tags" }} +

+
+
+
+ {{ range .Site.Taxonomies.tags.ByCount }} +
+
+ {{ .Name }} + + {{ .Count }} + +
+
+ {{ end }} +
- {{ end }} - {{ partial "paginator.html" . }}
+ {{ end }}
- {{ end }} \ No newline at end of file diff --git a/layouts/_default/term.html b/layouts/_default/term.html new file mode 100644 index 0000000..714d848 --- /dev/null +++ b/layouts/_default/term.html @@ -0,0 +1,58 @@ +{{ define "main" }} +{{- partial "header.html" . -}} +
+
+
+
+
+ {{ if eq .Data.Singular "category" }} + + {{ else if eq .Data.Singular "tag" }} + + {{ end }} +
+ {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ range $paginator.Pages }} +
+ {{ with .Params.Tags }} +
+ {{ range .}} + + {{ end }} +
+ {{ end }} +
+ {{ .Title }} +
+
+ {{ .Date.Format "2006/01/02" }} + {{ with .Params.Categories }} ・ + {{ range .}} + + {{ end }} + {{ end }} +
+
+ {{ end }} + {{ partial "paginator.html" . }} +
+
+
+
+
+
+{{ end }} \ No newline at end of file diff --git a/layouts/archives/single.html b/layouts/archives/single.html index 9cec5f7..f19ccac 100644 --- a/layouts/archives/single.html +++ b/layouts/archives/single.html @@ -1,39 +1,28 @@ - - -{{- partial "head.html" . -}} - - -
- {{- partial "header.html" . -}} -
- {{- block "archives-main" . }}{{- end }} -
-
- {{- partial "footer.html" . -}} - {{- partial "backtotop.html" . -}} - {{- block "script" . }}{{- end }} - - - - -{{ define "archives-main" }} -
-
- {{ $count := len (where (where .Site.Pages "Type" "post") "Kind" "page") }} -

{{ i18n "archives" (dict "Count" $count) }}

-
- {{ range (where (where .Site.Pages "Type" "post") "Kind" "page").GroupByDate "2006" }} -

{{ .Key }}

-
    - {{ range .Pages }} -
  • - {{ .Date.Format "2006/01/02" }} - {{ .Title }} -
  • - {{ end }} -
- {{ end }} +{{ define "main" }} +{{ partial "header.html" . }} +
+
+
+
+ {{ $count := len (where (where .Site.Pages "Type" "post") "Kind" "page") }} +

{{ i18n "archives" (dict "Count" $count) }}

+
+ {{ range (where (where .Site.Pages "Type" "post") "Kind" "page").GroupByDate "2006" }} +
+

{{ .Key }}

+
    + {{ range .Pages }} +
  • + {{ .Date.Format "2006/01/02" }} + {{ .Title }} +
  • + {{ end }} +
+
+ {{ end }} +
+
-
-{{ end }} + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index f2a8626..cde1b5e 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -1,7 +1,7 @@