博客侧边栏分类模块

本页内容

该模块于博客侧边栏显示分类列表。

Modulegithub.com/hbstack/blog/modules/sidebar/taxonomies
Repository⭐ Please consider giving a star if your like it.
Stars
Version
Used by
Requirements
License
UsageSee how to use modules.

站点参数

ParameterTypeRequiredDefaultDescription
countbooleantrue是否显示分类条目相关联的文章数量。
limitnumber10分类条目的最大数量。
separatestringfalse是否分成多个部分。
stylestringpillspillstabsunderline
[taxonomy]object特定分类的参数,比如 authorscategoriesseriestags
[taxonomy].countboolean若存在,则覆盖 count 参数。
[taxonomy].disablebooleanfalse是否禁用当前分类。
[taxonomy].limitnumber若存在,则覆盖 limit 参数。
[taxonomy].titlestring为当前分类指定另外的标题。
[taxonomy].weightnumber用于分类排序,值越低优先级越高。

hugo.toml

 1[params]
 2  [params.hb]
 3    [params.hb.blog]
 4      [params.hb.blog.sidebar]
 5        [params.hb.blog.sidebar.taxonomies]
 6          count = true
 7          limit = 10
 8          separate = false
 9          style = 'pills'
10          [params.hb.blog.sidebar.taxonomies.authors]
11            count = false
12            disable = false
13            limit = 5
14            weight = 1
15          [params.hb.blog.sidebar.taxonomies.categories]
16            disable = false
17            weight = 3
18          [params.hb.blog.sidebar.taxonomies.series]
19            disable = false
20            weight = 2
21          [params.hb.blog.sidebar.taxonomies.tags]
22            disable = false
23            limit = 20
24            title = 'Popular Tags'
25            weight = 4

hugo.yaml

 1params:
 2  hb:
 3    blog:
 4      sidebar:
 5        taxonomies:
 6          authors:
 7            count: false
 8            disable: false
 9            limit: 5
10            weight: 1
11          categories:
12            disable: false
13            weight: 3
14          count: true
15          limit: 10
16          separate: false
17          series:
18            disable: false
19            weight: 2
20          style: pills
21          tags:
22            disable: false
23            limit: 20
24            title: Popular Tags
25            weight: 4

hugo.json

 1{
 2   "params": {
 3      "hb": {
 4         "blog": {
 5            "sidebar": {
 6               "taxonomies": {
 7                  "authors": {
 8                     "count": false,
 9                     "disable": false,
10                     "limit": 5,
11                     "weight": 1
12                  },
13                  "categories": {
14                     "disable": false,
15                     "weight": 3
16                  },
17                  "count": true,
18                  "limit": 10,
19                  "separate": false,
20                  "series": {
21                     "disable": false,
22                     "weight": 2
23                  },
24                  "style": "pills",
25                  "tags": {
26                     "disable": false,
27                     "limit": 20,
28                     "title": "Popular Tags",
29                     "weight": 4
30                  }
31               }
32            }
33         }
34      }
35   }
36}