diff --git a/assets/scss/style.scss b/assets/scss/style.scss index 32c6ee6..a58003f 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -687,6 +687,25 @@ hr.post-end { } } +.related-posts { + padding: .8em; + margin-top: 1.5em; + font-size: .8rem; + border: 3px dashed rgba(255, 255, 255, .2); + border-radius: 5px; + + h2{ + margin: 0; + line-height: normal; + } + + ul { + margin-top: .5em; + margin-bottom: 0; + } +} + + // Media Queries // @media (min-width: 800px) { diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1f8be3b..3c94862 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -46,6 +46,8 @@ enableEmoji = true # Shorthand emojis in content files - https://gohugo.io/func # Toggling this option needs to rebuild SCSS, requires Hugo extended version justifyContent = false # Set "text-align: justify" to `.content`. + relatedPosts = false # Add a related content section to all single posts page + # Add custom css # customCSS = ["css/foo.css", "css/bar.css"] diff --git a/i18n/en.toml b/i18n/en.toml index 1b09bfc..e68038a 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -14,6 +14,9 @@ other = "Archives" # posts/single.html # +[seeAlso] +other = "See Also" + [wordCount] other = "{{ .WordCount }} Words" diff --git a/i18n/zh-hans.toml b/i18n/zh-hans.toml index 8884b93..b9c064a 100644 --- a/i18n/zh-hans.toml +++ b/i18n/zh-hans.toml @@ -14,6 +14,9 @@ other = "归档" # posts/single.html # +[seeAlso] +other = "相关推荐" + [wordCount] other = "{{ .WordCount }} 字" diff --git a/layouts/partials/related-posts.html b/layouts/partials/related-posts.html new file mode 100644 index 0000000..d533bfd --- /dev/null +++ b/layouts/partials/related-posts.html @@ -0,0 +1,11 @@ +{{- $related := .Site.RegularPages.Related . | first 5 }} +{{ with $related }} +
+{{ end -}} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 9557916..53c0818 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -25,6 +25,9 @@