Skip to content

Commit

Permalink
feat: new related Front Matter
Browse files Browse the repository at this point in the history
boolean, overwrite `displayRelatedPosts` in `config.toml`

BREAKING CHANGE: You must add `displayRelatedPosts = true` in
config.toml
  • Loading branch information
reuixiy committed Sep 1, 2019
1 parent 1269b9c commit dc983e5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ editText = "Edit Me?"

# Related Posts
enableRelatedPosts = true
displayRelatedPosts = true
relatedPostsNumber = 5
relatedPostsIcon = "plus-circle"

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h1 class="post-title">{{ .Title }}</h1>
</div>
{{ end }}

{{ if .Site.Params.enableRelatedPosts }}
{{ if .Params.related | default .Site.Params.displayRelatedPosts }}
{{ $related := .Site.RegularPages.Related . | first (.Site.Params.relatedPostsNumber | default 5) }}
{{ with $related }}
<div class="related-posts">
Expand Down

0 comments on commit dc983e5

Please sign in to comment.