diff --git a/README.md b/README.md index ea2dcf6..5d5e04c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/assets/css/main.css b/assets/css/main.css index 3015f38..3663bb4 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -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; diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 073f1dc..5e3d15a 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -17,6 +17,7 @@ dateFormat = "2006-01-02" paginationSinglePost = true style = "auto" readMore = false +readNextPosts = 2 copyCodeButton = true rssAsSocialIcon = true diff --git a/exampleSiteMultilingual/config.toml b/exampleSiteMultilingual/config.toml index e4e88e7..a18faea 100644 --- a/exampleSiteMultilingual/config.toml +++ b/exampleSiteMultilingual/config.toml @@ -18,6 +18,7 @@ dateFormat = "2006-01-02" paginationSinglePost = true style = "auto" readMore = false +readNextPosts = 2 copyCodeButton = true rssAsSocialIcon = true diff --git a/i18n/de.yaml b/i18n/de.yaml index 3c5bb6a..b06b956 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -42,3 +42,6 @@ darkTheme: lightTheme: other: "Helles Theme" + +readNext: + other: "Weiter lesen" \ No newline at end of file diff --git a/i18n/en.yaml b/i18n/en.yaml index 4059161..45e7d3f 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -42,3 +42,6 @@ darkTheme: lightTheme: other: "Light theme" + +readNext: + other: "Read next" diff --git a/i18n/fr.yaml b/i18n/fr.yaml index f5bdadf..3070df6 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -42,3 +42,6 @@ darkTheme: lightTheme: other: "Thème clair" + +readNext: + other: "Lire la suite" \ No newline at end of file diff --git a/i18n/pl.yaml b/i18n/pl.yaml index 1782dda..cce611e 100644 --- a/i18n/pl.yaml +++ b/i18n/pl.yaml @@ -42,3 +42,6 @@ darkTheme: lightTheme: other: "Jasny schemat" + +readNext: + other: "Czytaj dalej" \ No newline at end of file diff --git a/i18n/pt.yaml b/i18n/pt.yaml index 565ff7b..1a4b702 100644 --- a/i18n/pt.yaml +++ b/i18n/pt.yaml @@ -41,4 +41,7 @@ darkTheme: other: "Tema Escuro" lightTheme: - other: "Tema Claro" \ No newline at end of file + other: "Tema Claro" + +readNext: + other: "Leia a seguir" \ No newline at end of file diff --git a/i18n/ru.yaml b/i18n/ru.yaml index 5d7f52f..b9688fa 100644 --- a/i18n/ru.yaml +++ b/i18n/ru.yaml @@ -42,3 +42,6 @@ darkTheme: lightTheme: other: "Светлая тема" + +readNext: + other: "Читать далее" diff --git a/i18n/tw.yaml b/i18n/tw.yaml index 5d55d6c..05885c9 100644 --- a/i18n/tw.yaml +++ b/i18n/tw.yaml @@ -42,3 +42,6 @@ darkTheme: lightTheme: other: "亮色主題" + +readNext: + other: "閱讀下一篇" \ No newline at end of file diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index befc53e..858f820 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -41,4 +41,7 @@ darkTheme: other: "暗色主题" lightTheme: - other: "亮色主题" \ No newline at end of file + other: "亮色主题" + +readNext: + other: "继续阅读" diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 72cc1de..4202051 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -21,6 +21,18 @@ {{ partial "post-info.html" . }} + {{ if gt .Site.Params.readNextPosts 0 }} + {{ $related := .Site.RegularPages.Related . | first .Site.Params.readNextPosts }} + {{ with $related }} +