深度阅读

hugo添加相关内容

作者
作者
2023年08月22日
更新时间
6.55 分钟
阅读时间
0
阅读量

修改主题中的如下文件,如果没有可以创建。

layouts / partials / related.html

{{ $related := .Site.RegularPages.Related . \| first 5 }}
{{ with $related }}
<h3>See Also</h3>
<ul>
    \{\{ range . \}\}
    <li><a href="\{\{ .RelPermalink \}\}">{{ .Title }}</a></li>
    {{ end }}
</ul>
{{ end }}

<p>config.toml文件中添加如下内容</p>
<p>```
[related]
includeNewer = false
threshold = 80
toLower = false

[[related.indices]]
name = “keywords”
weight = 100

[[related.indices]]
name = “tags”
weight = 90

[[related.indices]]
name = “date”
weight = 10
```

发布文章时候不要忘记在头部添加tags内容,还有可以添加keywords.
tags: - niubi - haha

文档地址
https://gohugo.io/content-management/related/

相关标签

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。