mirror of
https://github.com/HEIGE-PCloud/DoIt
synced 2025-04-29 15:57:35 +08:00
[FEATURE]: Add Series Taxonomy (#123)
* feat: add basic series taxonomy * feat(series-taxonomy) add support for basic intro * feat(series-taxonomy) add support for summary and meta * feat(series-taxonomy): add i18n and docs
This commit is contained in:
parent
ee866f94c1
commit
c74187e8cb
@ -9,6 +9,7 @@ description: ""
|
||||
|
||||
tags: []
|
||||
categories: []
|
||||
series: []
|
||||
|
||||
hiddenFromHomePage: false
|
||||
hiddenFromSearch: false
|
||||
|
@ -63,7 +63,7 @@
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.categories-card, .author-card {
|
||||
.categories-card, .author-card, .series-card {
|
||||
.card-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
@ -33,3 +33,4 @@
|
||||
@import "_archive";
|
||||
@import "_home";
|
||||
@import "_404";
|
||||
@import "_taxonomy";
|
||||
|
16
assets/css/_page/_taxonomy.scss
Normal file
16
assets/css/_page/_taxonomy.scss
Normal file
@ -0,0 +1,16 @@
|
||||
.introduction blockquote {
|
||||
display: block;
|
||||
border-left: .5rem solid $blockquote-color;
|
||||
background-color: rgba($blockquote-color, .2);
|
||||
padding: .25rem .75rem;
|
||||
margin: 1rem 0;
|
||||
|
||||
[theme=dark] & {
|
||||
border-left-color: $blockquote-color-dark;
|
||||
background-color: rgba($blockquote-color-dark, .2);
|
||||
}
|
||||
[theme=black] & {
|
||||
border-left-color: $blockquote-color-black;
|
||||
background-color: rgba($blockquote-color-black, .2);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
.categories-card, .author-card {
|
||||
.categories-card, .author-card, .series-card {
|
||||
margin: 0 auto;
|
||||
margin-top: 3rem;
|
||||
display: flex;
|
||||
|
@ -67,6 +67,14 @@ enableEmoji = true
|
||||
url = "/categories/"
|
||||
title = ""
|
||||
weight = 3
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "series"
|
||||
pre = ""
|
||||
post = ""
|
||||
name = "Series"
|
||||
url = "/series/"
|
||||
title = ""
|
||||
weight = 4
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "authors"
|
||||
pre = ""
|
||||
@ -74,7 +82,7 @@ enableEmoji = true
|
||||
name = "Authors"
|
||||
url = "/authors/"
|
||||
title = ""
|
||||
weight = 4
|
||||
weight = 5
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "documentation"
|
||||
pre = ""
|
||||
@ -82,7 +90,7 @@ enableEmoji = true
|
||||
name = "Docs"
|
||||
url = "/categories/documentation/"
|
||||
title = ""
|
||||
weight = 5
|
||||
weight = 6
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "about"
|
||||
pre = ""
|
||||
@ -90,7 +98,7 @@ enableEmoji = true
|
||||
name = "About"
|
||||
url = "/about/"
|
||||
title = ""
|
||||
weight = 6
|
||||
weight = 7
|
||||
[[languages.en.menu.main]]
|
||||
identifier = "github"
|
||||
pre = "<i class='fab fa-github fa-fw'></i>"
|
||||
@ -98,7 +106,7 @@ enableEmoji = true
|
||||
name = ""
|
||||
url = "https://github.com/HEIGE-PCloud/DoIt"
|
||||
title = "GitHub"
|
||||
weight = 7
|
||||
weight = 8
|
||||
[languages.en.params]
|
||||
# site description
|
||||
description = "About DoIt Theme"
|
||||
@ -286,6 +294,14 @@ enableEmoji = true
|
||||
url = "/categories/"
|
||||
title = ""
|
||||
weight = 3
|
||||
[[languages.zh-cn.menu.main]]
|
||||
identifier = "series"
|
||||
pre = ""
|
||||
post = ""
|
||||
name = "系列"
|
||||
url = "/series/"
|
||||
title = ""
|
||||
weight = 4
|
||||
[[languages.zh-cn.menu.main]]
|
||||
identifier = "authors"
|
||||
pre = ""
|
||||
@ -293,14 +309,14 @@ enableEmoji = true
|
||||
name = "作者"
|
||||
url = "/authors/"
|
||||
title = ""
|
||||
weight = 4
|
||||
weight = 5
|
||||
[[languages.zh-cn.menu.main]]
|
||||
identifier = "documentation"
|
||||
pre = ""
|
||||
name = "文档"
|
||||
url = "/categories/documentation/"
|
||||
title = ""
|
||||
weight = 5
|
||||
weight = 6
|
||||
[[languages.zh-cn.menu.main]]
|
||||
identifier = "about"
|
||||
pre = ""
|
||||
@ -308,7 +324,7 @@ enableEmoji = true
|
||||
name = "关于"
|
||||
url = "/about/"
|
||||
title = ""
|
||||
weight = 6
|
||||
weight = 7
|
||||
[[languages.zh-cn.menu.main]]
|
||||
identifier = "github"
|
||||
pre = "<i class='fab fa-github fa-fw'></i>"
|
||||
@ -316,7 +332,7 @@ enableEmoji = true
|
||||
name = ""
|
||||
url = "https://github.com/HEIGE-PCloud/DoIt"
|
||||
title = "GitHub"
|
||||
weight = 7
|
||||
weight = 8
|
||||
[languages.zh-cn.params]
|
||||
# 网站描述
|
||||
description = "关于 DoIt 主题"
|
||||
@ -1205,7 +1221,10 @@ enableEmoji = true
|
||||
taxonomy = ["HTML", "RSS"]
|
||||
taxonomyTerm = ["HTML"]
|
||||
|
||||
# Options for taxonomies
|
||||
# 用于分类的设置
|
||||
[taxonomies]
|
||||
author = "authors"
|
||||
category = "categories"
|
||||
tag = "tags"
|
||||
series = "series"
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "Series Taxonomy Test"
|
||||
date: 2021-07-03T22:15:26+08:00
|
||||
lastmod: 2021-07-03T22:15:26+08:00
|
||||
draft: false
|
||||
description: "Series Taxonomy Test"
|
||||
categories: [Tests]
|
||||
series: [Test pages]
|
||||
hiddenFromHomePage: true
|
||||
hiddenFromSearch: true
|
||||
---
|
||||
|
||||
<!--more-->
|
||||
|
||||
[Series Taxonomy](/series)
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "系列分类测试"
|
||||
date: 2021-07-03T22:15:26+08:00
|
||||
lastmod: 2021-07-03T22:15:26+08:00
|
||||
draft: false
|
||||
description: "系列分类测试"
|
||||
categories: [Tests]
|
||||
series: [Test pages]
|
||||
hiddenFromHomePage: true
|
||||
hiddenFromSearch: true
|
||||
---
|
||||
|
||||
<!--more-->
|
||||
|
||||
[系列分类](/zh-cn/series)
|
@ -764,6 +764,12 @@ Please open the code block below to view the complete sample configuration :(far
|
||||
taxonomy = ["HTML", "RSS"]
|
||||
taxonomyTerm = ["HTML"]
|
||||
|
||||
# Options for taxonomies
|
||||
[taxonomies]
|
||||
author = "authors"
|
||||
category = "categories"
|
||||
tag = "tags"
|
||||
series = "series"
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
|
@ -768,6 +768,12 @@ hugo
|
||||
taxonomy = ["HTML", "RSS"]
|
||||
taxonomyTerm = ["HTML"]
|
||||
|
||||
# 用于分类的设置
|
||||
[taxonomies]
|
||||
author = "authors"
|
||||
category = "categories"
|
||||
tag = "tags"
|
||||
series = "series"
|
||||
```
|
||||
|
||||
{{< admonition >}}
|
||||
|
@ -109,6 +109,7 @@ images: []
|
||||
|
||||
tags: []
|
||||
categories: []
|
||||
series: []
|
||||
featuredImage: ""
|
||||
featuredImagePreview: ""
|
||||
|
||||
@ -169,6 +170,7 @@ seo:
|
||||
|
||||
* **tags**: the tags for the content.
|
||||
* **categories**: the categories for the content.
|
||||
* **series**: {{< version 0.2.12 >}} the series for the content.
|
||||
* **featuredImage**: the featured image for the content.
|
||||
* **featuredImagePreview**: the featured image for the content preview in the home page.
|
||||
|
||||
|
@ -108,6 +108,7 @@ images: []
|
||||
|
||||
tags: []
|
||||
categories: []
|
||||
series: []
|
||||
featuredImage: ""
|
||||
featuredImagePreview: ""
|
||||
|
||||
@ -168,6 +169,7 @@ seo:
|
||||
|
||||
* **tags**: 文章的标签.
|
||||
* **categories**: 文章所属的类别.
|
||||
* **series**: {{< version 0.2.12 >}} 文章所属的系列.
|
||||
* **featuredImage**: 文章的特色图片.
|
||||
* **featuredImagePreview**: 用在主页预览的文章特色图片.
|
||||
|
||||
|
3
exampleSite/content/series/_index.en.md
Normal file
3
exampleSite/content/series/_index.en.md
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
title: Series
|
||||
---
|
3
exampleSite/content/series/_index.zh-cn.md
Normal file
3
exampleSite/content/series/_index.zh-cn.md
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
title: 系列
|
||||
---
|
4
exampleSite/content/series/test-pages/_index.en.md
Normal file
4
exampleSite/content/series/test-pages/_index.en.md
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Test Pages
|
||||
introduction: These pages are used to test and debug the DoIt theme.
|
||||
---
|
4
exampleSite/content/series/test-pages/_index.zh-cn.md
Normal file
4
exampleSite/content/series/test-pages/_index.zh-cn.md
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
title: 测试页面系列
|
||||
introduction: 这些页面用于测试与调试 DoIt 主题。
|
||||
---
|
File diff suppressed because one or more lines are too long
15
i18n/en.toml
15
i18n/en.toml
@ -29,6 +29,9 @@ other = "Category"
|
||||
|
||||
[categories]
|
||||
other = "Categories"
|
||||
|
||||
[series]
|
||||
other = "Series"
|
||||
# === Taxonomy ===
|
||||
|
||||
# === Pagination ===
|
||||
@ -116,8 +119,18 @@ other = "Contents"
|
||||
[publishedOnDate]
|
||||
other = "published on {{ .Date }}"
|
||||
|
||||
[includedIn]
|
||||
other = "included in "
|
||||
|
||||
[includedInAnd]
|
||||
other = "and"
|
||||
|
||||
[includedInCategories]
|
||||
other = "included in {{ .Categories }}"
|
||||
one = "category {{ .Categories }}"
|
||||
other = "categories {{ .Categories }}"
|
||||
|
||||
[includedInSeries]
|
||||
other = "series {{ .Series }}"
|
||||
|
||||
[wordCount]
|
||||
one = "One word"
|
||||
|
@ -30,6 +30,9 @@ other = "分类"
|
||||
|
||||
[categories]
|
||||
other = "分类"
|
||||
|
||||
[series]
|
||||
other = "系列"
|
||||
# === Taxonomy ===
|
||||
|
||||
# === Pagination ===
|
||||
@ -123,8 +126,17 @@ other = "目录"
|
||||
[publishedOnDate]
|
||||
other = "发布于 {{ .Date }}"
|
||||
|
||||
[includedIn]
|
||||
other = "收录于 "
|
||||
|
||||
[includedInAnd]
|
||||
other = "和"
|
||||
|
||||
[includedInCategories]
|
||||
other = "收录于 {{ .Categories }}"
|
||||
other = "类别 {{ .Categories }}"
|
||||
|
||||
[includedInSeries]
|
||||
other = "系列 {{ .Series }}"
|
||||
|
||||
[wordCount]
|
||||
other = "约 {{ .Count }} 字"
|
||||
|
@ -45,16 +45,39 @@
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- $categories := slice -}}
|
||||
{{- range .Params.categories -}}
|
||||
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
||||
{{- end -}}
|
||||
{{- with delimit $categories " " -}}
|
||||
<span class="post-category">
|
||||
{{- dict "Categories" . | T "includedInCategories" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
{{- with (or (.Params.categories) (.Params.series)) -}}
|
||||
<span class="post-category">
|
||||
{{- T "includedIn" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- $categories := slice -}}
|
||||
{{- range .Params.categories -}}
|
||||
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
||||
{{- end -}}
|
||||
{{- with delimit $categories " " -}}
|
||||
<span class="post-category">
|
||||
{{- dict "Categories" . "Count" (len $categories) | T "includedInCategories" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- with (and (.Params.categories) (.Params.series)) -}}
|
||||
<span class="post-category">
|
||||
{{- T "includedInAnd" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- $series := slice -}}
|
||||
{{- range .Params.series -}}
|
||||
{{- $singleSeries := partialCached "function/path.html" . . | printf "/series/%v" | $.Site.GetPage -}}
|
||||
{{- $series = $series | append (printf `<a href="%v"><i class="far fa-list-alt fa-fw"></i>%v</a>` $singleSeries.RelPermalink $singleSeries.Title) -}}
|
||||
{{- end -}}
|
||||
{{- with delimit $series " " -}}
|
||||
<span class="post-series">
|
||||
{{- dict "Series" . | T "includedInSeries" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Summary content */ -}}
|
||||
|
@ -11,7 +11,7 @@
|
||||
{{- if $.Site.Params.search.absoluteURL -}}
|
||||
{{- $uri = .Permalink -}}
|
||||
{{- end -}}
|
||||
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories -}}
|
||||
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories "series" .Params.series -}}
|
||||
{{- $meta = $.Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format | dict "date" | merge $meta -}}
|
||||
{{- with .Description -}}
|
||||
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
|
||||
|
@ -52,7 +52,12 @@
|
||||
<span class="post-author">
|
||||
{{- partial "meta/author.html" . }}
|
||||
</span>
|
||||
|
||||
{{- with (or (.Params.categories) (.Params.series)) -}}
|
||||
<span class="post-category">
|
||||
{{- T "includedIn" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- $categories := slice -}}
|
||||
{{- range .Params.categories -}}
|
||||
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||
@ -60,7 +65,24 @@
|
||||
{{- end -}}
|
||||
{{- with delimit $categories " " -}}
|
||||
<span class="post-category">
|
||||
{{- dict "Categories" . | T "includedInCategories" | safeHTML -}}
|
||||
{{- dict "Categories" . "Count" (len $categories) | T "includedInCategories" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- with (and (.Params.categories) (.Params.series)) -}}
|
||||
<span class="post-category">
|
||||
{{- T "includedInAnd" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- $series := slice -}}
|
||||
{{- range .Params.series -}}
|
||||
{{- $singleSeries := partialCached "function/path.html" . . | printf "/series/%v" | $.Site.GetPage -}}
|
||||
{{- $series = $series | append (printf `<a href="%v"><i class="far fa-list-alt fa-fw"></i>%v</a>` $singleSeries.RelPermalink $singleSeries.Title) -}}
|
||||
{{- end -}}
|
||||
{{- with delimit $series " " -}}
|
||||
<span class="post-series">
|
||||
{{- dict "Series" . | T "includedInSeries" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
@ -25,7 +25,12 @@
|
||||
{{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}}
|
||||
{{- end -}}
|
||||
</h2>
|
||||
|
||||
{{- /* Introduction*/ -}}
|
||||
{{- with .Params.introduction -}}
|
||||
<div class="introduction">
|
||||
<blockquote>{{- . -}}</blockquote>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- /* Paginate */ -}}
|
||||
{{- if .Pages -}}
|
||||
{{- $pages := .Pages.GroupByDate "2006" -}}
|
||||
|
@ -45,6 +45,39 @@
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Series Page */ -}}
|
||||
{{- else if eq $taxonomies "series" -}}
|
||||
{{- $terms := .Data.Terms.ByCount -}}
|
||||
<div class="series-card">
|
||||
{{- range $terms -}}
|
||||
{{- $term := .Term -}}
|
||||
{{- $pages := .Pages -}}
|
||||
{{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}}
|
||||
<div class="card-item">
|
||||
<div class="card-item-wrapper">
|
||||
<h3 class="card-item-title">
|
||||
<a href="{{ .RelPermalink }}">
|
||||
<i class="far fa-folder fa-fw"></i> {{ .Page.Title }}
|
||||
</a>
|
||||
</h3>
|
||||
{{- range first 5 $pages -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- if gt (len $pages) 5 -}}
|
||||
<span class="more-post">
|
||||
<a href="{{ .RelPermalink }}" class="more-single-link">{{ T "more" }} >></a>
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Author Page */ -}}
|
||||
{{- else if eq $taxonomies "authors" -}}
|
||||
{{- $terms := .Data.Terms.Alphabetical -}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user