From dc983e5c79b915ddbc1b39ebc1b7007f39ae8bc5 Mon Sep 17 00:00:00 2001 From: reuixiy Date: Sun, 1 Sep 2019 21:47:41 +0800 Subject: [PATCH] feat: new `related` Front Matter boolean, overwrite `displayRelatedPosts` in `config.toml` BREAKING CHANGE: You must add `displayRelatedPosts = true` in config.toml --- README.md | 1 + exampleSite/config.toml | 1 + layouts/partials/post.html | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46797c2a..0ab93c47 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ toc | display TOC | boolean, overwrite `enableTOC` in `config.toml`, theme only displayCopyright | display post-copyright | boolean, overwrite `displayPostCopyright` in `config.toml`, theme only badge | display updated-badge | boolean, overwrite `displayUpdatedBadge` in `config.toml`, theme only gitinfo | display post-gitinfo | boolean, overwrite `displayPostGitInfo` in `config.toml`, theme only +related | display related-posts | boolean, overwrite `displayRelatedPosts` in `config.toml`, theme only katex | add KaTeX support | boolean, overwrite `enableKaTeX` in `config.toml`, theme only comments | set `false` to disable comments in postSections or set `true` to enable comments in non-postSections | boolean, theme only original | original? You can add the following 9 terms if you set `false`. The `author` is required, other optional | boolean, overwrite `original` in `config.toml`, theme only diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e71926b9..09c6a7a1 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -696,6 +696,7 @@ editText = "Edit Me?" # Related Posts enableRelatedPosts = true +displayRelatedPosts = true relatedPostsNumber = 5 relatedPostsIcon = "plus-circle" diff --git a/layouts/partials/post.html b/layouts/partials/post.html index 7145f8ef..f2289efc 100644 --- a/layouts/partials/post.html +++ b/layouts/partials/post.html @@ -116,7 +116,7 @@

{{ .Title }}

{{ end }} - {{ if .Site.Params.enableRelatedPosts }} + {{ if .Params.related | default .Site.Params.displayRelatedPosts }} {{ $related := .Site.RegularPages.Related . | first (.Site.Params.relatedPostsNumber | default 5) }} {{ with $related }}