相关文章

本页内容

该模块于博文内容下方显示相关文章。

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

站点配置

你也许需要调整默认的 related 配置以满足你的需求。

hugo.toml

 1[related]
 2  includeNewer = true
 3  threshold = 60
 4  toLower = false
 5[[related.indices]]
 6    name = 'keywords'
 7    weight = 100
 8[[related.indices]]
 9    name = 'tags'
10    weight = 80
11[[related.indices]]
12    name = 'categories'
13    weight = 60
14[[related.indices]]
15    name = 'series'
16    weight = 60
17[[related.indices]]
18    name = 'authors'
19    weight = 10
20[[related.indices]]
21    name = 'date'
22    weight = 10

hugo.yaml

 1related:
 2  includeNewer: true
 3  indices:
 4  - name: keywords
 5    weight: 100
 6  - name: tags
 7    weight: 80
 8  - name: categories
 9    weight: 60
10  - name: series
11    weight: 60
12  - name: authors
13    weight: 10
14  - name: date
15    weight: 10
16  threshold: 60
17  toLower: false

hugo.json

 1{
 2   "related": {
 3      "includeNewer": true,
 4      "indices": [
 5         {
 6            "name": "keywords",
 7            "weight": 100
 8         },
 9         {
10            "name": "tags",
11            "weight": 80
12         },
13         {
14            "name": "categories",
15            "weight": 60
16         },
17         {
18            "name": "series",
19            "weight": 60
20         },
21         {
22            "name": "authors",
23            "weight": 10
24         },
25         {
26            "name": "date",
27            "weight": 10
28         }
29      ],
30      "threshold": 60,
31      "toLower": false
32   }
33}