diff options
author | zilch40 <wlh233@live.com> | 2020-11-15 13:24:58 +0300 |
---|---|---|
committer | zilch40 <wlh233@live.com> | 2020-11-15 13:24:58 +0300 |
commit | 88fb497815279a64bbfe38e7cdd1676a2b683b77 (patch) | |
tree | 9133e615d34dc13ad930c3f6d998c5f917d85f6a | |
parent | c7e401969102c1c66d8492a0e314d1b71f48223e (diff) |
modify taxonomy related pages && archive pages
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | assets/css/common.scss | 11 | ||||
-rw-r--r-- | i18n/en.toml | 9 | ||||
-rw-r--r-- | i18n/zh-cn.toml | 9 | ||||
-rw-r--r-- | layouts/_default/taxonomy.html | 69 | ||||
-rw-r--r-- | layouts/_default/term.html | 58 | ||||
-rw-r--r-- | layouts/archives/single.html | 63 | ||||
-rw-r--r-- | layouts/partials/nav.html | 2 | ||||
-rw-r--r-- | layouts/partials/posts.html | 23 |
9 files changed, 150 insertions, 103 deletions
@@ -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 "posts.html" . -}} --> +{{ partial "header.html" . }} <section class="section"> <div class="container"> <div class="columns"> <div class="column is-2"></div> <div class="column is-8"> - <div class="content"> - {{ if eq .Data.Singular "category" }} - <h3> - {{- i18n "taxo_cat_before" -}} - <span class="tag mytag">{{ .Data.Term }}</span> - {{- i18n "taxo_after" -}} - </h3> - {{ else if eq .Data.Singular "tag" }} - <h3> - {{- i18n "taxo_tag_before" -}} - <span class="tag mytag"><a>{{ .Data.Term }}</a></span> - {{- i18n "taxo_after" -}} - </h3> - {{ end }} + {{ if eq .Data.Singular "category" }} + <div class="card"> + <header class="card-header is-primary"> + <p class="card-header-title"> + {{ i18n "categories" }} + </p> + </header> + <div class="card-content"> + <div class="content is-medium"> + {{ range .Site.Taxonomies.categories.ByCount }} + <div class="container" style="margin-bottom: 0.5rem"> + <a href="{{ "/categories/" | relLangURL }}{{ .Name | urlize }}">{{ .Name }}</a> + <span class="tag is-pulled-right"> + {{ .Count }} + </span> + </div> + {{ end }} + </div> + </div> </div> - <div class="post-lists"> - {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} - {{ range $paginator.Pages }} - <div class="one-post box"> - <div class="is-6">{{ .Date.Format "2006/01/02" }}</div> - <div><a href="{{.Permalink }}" class="title is-size-5">{{ .Title }}</a></div> + <br> + {{ end }} + + {{ if eq .Data.Singular "tag" }} + <div class="card"> + <header class="card-header"> + <p class="card-header-title"> + {{ i18n "tags" }} + </p> + </header> + <div class="card-content"> + <div class="field is-grouped is-grouped-multiline"> + {{ range .Site.Taxonomies.tags.ByCount }} + <div class="control"> + <div class="tags has-addons"> + <a class="tag is-medium" href="{{ "/tags/" | relLangURL }}{{ .Name | urlize }}/">{{ .Name }}</a> + <span class="tag is-medium is-primary"> + {{ .Count }} + </span> + </div> + </div> + {{ end }} + </div> </div> - {{ end }} - {{ partial "paginator.html" . }} </div> + {{ end }} </div> <div class="column is-2"></div> </div> </div> </section> - {{ 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" . -}} +<section class="section"> + <div class="container"> + <div class="columns"> + <div class="column is-2"></div> + <div class="column is-8"> + {{ if eq .Data.Singular "category" }} + <nav class="breadcrumb is-centered is-medium" aria-label="breadcrumbs"> + <ul> + <li><a href="/categories">{{- i18n "categories" -}}</a></li> + <li class="is-active"><a href="#">{{ .Data.Term }}</a></li> + </ul> + </nav> + {{ else if eq .Data.Singular "tag" }} + <nav class="breadcrumb is-centered is-medium" aria-label="breadcrumbs"> + <ul> + <li><a href="/tags">{{- i18n "tags" -}}</a></li> + <li class="is-active"><a href="#">{{ .Data.Term }}</a></li> + </ul> + </nav> + {{ end }} + <div class="post-lists"> + {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ range $paginator.Pages }} + <div class="box post-box"> + {{ with .Params.Tags }} + <div class="post-box-tags"> + {{ range .}} + <span class="post-tag post-box-tag"> + <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">#{{ . }}</a> + </span> + {{ end }} + </div> + {{ end }} + <div class="post-box-title"> + <a href="{{.Permalink }}" class="title is-size-5">{{ .Title }}</a> + </div> + <div class="post-box-meta"> + {{ .Date.Format "2006/01/02" }} + {{ with .Params.Categories }} ・ + {{ range .}} + <span class="post-tag post-box-category"> + <a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}">{{ . }}</a> + </span> + {{ end }} + {{ end }} + </div> + </div> + {{ end }} + {{ partial "paginator.html" . }} + </div> + </div> + <div class="column is-2"></div> + </div> + </div> +</section> +{{ 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 @@ -<!DOCTYPE html> -<html> -{{- partial "head.html" . -}} - -<body> - <div id="main"> - {{- partial "header.html" . -}} - <section class="section"> - {{- block "archives-main" . }}{{- end }} - </section> - </div> - {{- partial "footer.html" . -}} - {{- partial "backtotop.html" . -}} - {{- block "script" . }}{{- end }} -</body> - -</html> - -{{ define "archives-main" }} -<div class="container"> - <div class="box content"> - {{ $count := len (where (where .Site.Pages "Type" "post") "Kind" "page") }} - <p>{{ i18n "archives" (dict "Count" $count) }}</p> - <div class="post-archive"> - {{ range (where (where .Site.Pages "Type" "post") "Kind" "page").GroupByDate "2006" }} - <h2>{{ .Key }}</h2> - <ul class="listing"> - {{ range .Pages }} - <li> - <span class="date">{{ .Date.Format "2006/01/02" }} </span> - <a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a> - </li> - {{ end }} - </ul> - {{ end }} +{{ define "main" }} +{{ partial "header.html" . }} +<section class="section"> + <div class="container content"> + <div class="columns"> + <div class="column is-8 is-offset-2"> + {{ $count := len (where (where .Site.Pages "Type" "post") "Kind" "page") }} + <h2 class="has-text-centered">{{ i18n "archives" (dict "Count" $count) }}</h2> + <div class="post-archive"> + {{ range (where (where .Site.Pages "Type" "post") "Kind" "page").GroupByDate "2006" }} + <div class="box container"> + <h3>{{ .Key }}</h3> + <ul class="listing"> + {{ range .Pages }} + <li> + <span class="date">{{ .Date.Format "2006/01/02" }} </span> + <a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a> + </li> + {{ end }} + </ul> + </div> + {{ end }} + </div> + </div> </div> </div> -</div> -{{ end }} +</section> +{{ 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 @@ <nav class="navbar is-primary"> <div class="container"> <div class="navbar-brand"> - <a class="navbar-item {{if eq .Kind "home"}}fake-text{{end}}" href="/"> + <a class="navbar-item" href="/"> {{.Site.Title}} </a> <a role="button" class="navbar-burger" data-target="navMenu" aria-label="menu" aria-expanded="false"> diff --git a/layouts/partials/posts.html b/layouts/partials/posts.html index 3c6512f..6b3aed5 100644 --- a/layouts/partials/posts.html +++ b/layouts/partials/posts.html @@ -47,11 +47,11 @@ </header> <div class="card-content"> <div class="content"> - {{ range $name, $taxonomy := .Site.Taxonomies.categories }} + {{ range .Site.Taxonomies.categories.ByCount }} <div class="container" style="margin-bottom: 0.5rem"> - <a href="{{ "/categories/" | relLangURL }}{{ $name | urlize }}">{{ $name }}</a> + <a href="{{ "/categories/" | relLangURL }}{{ .Name | urlize }}">{{ .Name }}</a> <span class="tag is-pulled-right"> - {{ $taxonomy.Count }} + {{ .Count }} </span> </div> {{ end }} @@ -69,14 +69,17 @@ </p> </header> <div class="card-content"> - <div class="content"> - <div class="tags"> - {{ range $name, $taxonomy := .Site.Taxonomies.tags }} - <span class="tag"> - <a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}/">{{ $name }}</a> - </span> - {{ end }} + <div class="field is-grouped is-grouped-multiline"> + {{ range .Site.Taxonomies.tags.ByCount }} + <div class="control"> + <div class="tags has-addons"> + <a class="tag" href="{{ "/tags/" | relLangURL }}{{ .Name | urlize }}/">{{ .Name }}</a> + <span class="tag"> + {{ .Count }} + </span> + </div> </div> + {{ end }} </div> </div> </div> |