Add See Next section #44

This commit is contained in:
Dmitry Kolosov 2022-02-18 12:29:49 +03:00
parent 5c94f0297f
commit 4503d1b7a3
13 changed files with 56 additions and 3 deletions

View File

@ -20,6 +20,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
- ISSO
- Utteranc.es
- RSS feeds
- Related posts (Read Next section)
- Deploy via Netlify (config included in example site)
- Hiding posts from the RSS feed
- Hidden posts (available only by link)
@ -82,7 +83,8 @@ params:
dateFormat: "2006-01-02"
paginationSinglePost: true
style: light-without-switcher
readMore: false
readMore: false # show read more button
readNextPosts: 5 # show 5 related posts, 0 by default
disableSummary: false
copyCodeButton: true # true by default
rssAsSocialIcon: true
@ -216,6 +218,9 @@ For production — allow all, for other — disallow all.
### Favorite posts
Add `favorite: true` to post front matter. It adds a "★" icon nearby post's title.
### Related posts (Read Next section)
Based on `readNextPosts` config parameter. Check [this article](https://gohugo.io/content-management/related/#configure-related-content) for configuration details.
### Hiding posts from RSS
Add `disable_feed: true` to post front matter.

View File

@ -556,6 +556,16 @@ article figcaption {
color: var(--link-state-color);
}
.read-next-title {
margin-bottom: 0;
}
.read-next-posts {
margin-top: 5px;
list-style-type:"- ";
padding-inline-start: 20px;
}
/* Other pages */
.terms {
list-style-type: none;

View File

@ -17,6 +17,7 @@ dateFormat = "2006-01-02"
paginationSinglePost = true
style = "auto"
readMore = false
readNextPosts = 2
copyCodeButton = true
rssAsSocialIcon = true

View File

@ -18,6 +18,7 @@ dateFormat = "2006-01-02"
paginationSinglePost = true
style = "auto"
readMore = false
readNextPosts = 2
copyCodeButton = true
rssAsSocialIcon = true

View File

@ -42,3 +42,6 @@ darkTheme:
lightTheme:
other: "Helles Theme"
readNext:
other: "Weiter lesen"

View File

@ -42,3 +42,6 @@ darkTheme:
lightTheme:
other: "Light theme"
readNext:
other: "Read next"

View File

@ -42,3 +42,6 @@ darkTheme:
lightTheme:
other: "Thème clair"
readNext:
other: "Lire la suite"

View File

@ -42,3 +42,6 @@ darkTheme:
lightTheme:
other: "Jasny schemat"
readNext:
other: "Czytaj dalej"

View File

@ -42,3 +42,6 @@ darkTheme:
lightTheme:
other: "Tema Claro"
readNext:
other: "Leia a seguir"

View File

@ -42,3 +42,6 @@ darkTheme:
lightTheme:
other: "Светлая тема"
readNext:
other: "Читать далее"

View File

@ -42,3 +42,6 @@ darkTheme:
lightTheme:
other: "亮色主題"
readNext:
other: "閱讀下一篇"

View File

@ -42,3 +42,6 @@ darkTheme:
lightTheme:
other: "亮色主题"
readNext:
other: "继续阅读"

View File

@ -21,6 +21,18 @@
{{ partial "post-info.html" . }}
</article>
{{ if gt .Site.Params.readNextPosts 0 }}
{{ $related := .Site.RegularPages.Related . | first .Site.Params.readNextPosts }}
{{ with $related }}
<h3 class="read-next-title">{{ i18n "readNext" }}</h3>
<ul class="read-next-posts">
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ end }}
{{ if and (.Site.Params.paginationSinglePost) (ne .Type "page") }}
{{ partial "post-pagination.html" . }}
{{ end }}