diff options
| author | Eltrac <hi@guhub.cn> | 2025-04-18 14:35:41 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-04-18 14:35:41 +0800 |
| commit | 92188549d8cae1ed58b57cba2229217b9c1ff75c (patch) | |
| tree | 0360b9c4d0a53b993f0d5b75570729a1d84d6e93 | |
| parent | 77deec1a30d2acdffb401253675deb05c20b4677 (diff) | |
feat: related posts after content
Former-commit-id: 74ac7cc4e0104cd4953a0df305815f1260596cca
| -rw-r--r-- | i18n/en.yml | 1 | ||||
| -rw-r--r-- | i18n/zh.yml | 1 | ||||
| -rw-r--r-- | layouts/_default/single.html | 8 |
3 files changed, 10 insertions, 0 deletions
diff --git a/i18n/en.yml b/i18n/en.yml index 2a53c6d3..5d0ed65e 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -17,3 +17,4 @@ postNav: moreLinks: posts: 'All Posts' cards: 'All Cards' +relatedContent: 'Related Content' diff --git a/i18n/zh.yml b/i18n/zh.yml index f5335290..a827365d 100644 --- a/i18n/zh.yml +++ b/i18n/zh.yml @@ -18,3 +18,4 @@ cards: 最近在学 moreLinks: posts: '所有文章' cards: '所有卡片' +relatedContent: '相关文章' diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0796701f..f81f9208 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -55,6 +55,14 @@ {{ if in .Site.Params.mainSections .Type }} {{ partial "components/comment.html" . }} + {{ with site.RegularPages.Related . | first 5 }} + <p>{{ T "relatedContent" }}</p> + <ul> + {{ range . }} + <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> + {{ end }} + </ul> + {{ end }} {{ end }} <script src="/js/tocbot.min.js"></script> |
