diff --git a/archetypes/post-bundle/index.md b/archetypes/post-bundle/index.md index 22447759..103b7cd6 100644 --- a/archetypes/post-bundle/index.md +++ b/archetypes/post-bundle/index.md @@ -20,6 +20,7 @@ categories: hiddenFromHomePage: false hiddenFromSearch: false hiddenFromRss: false +hiddenFromRelated: false summary: resources: - name: featured-image diff --git a/archetypes/posts.md b/archetypes/posts.md index 1e96662e..9f99da36 100644 --- a/archetypes/posts.md +++ b/archetypes/posts.md @@ -20,6 +20,7 @@ categories: hiddenFromHomePage: false hiddenFromSearch: false hiddenFromRss: false +hiddenFromRelated: false summary: resources: - name: featured-image diff --git a/docs b/docs index fc4dbfa1..95fde1f0 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit fc4dbfa115462c7dd1989f25a94d96d561b9b58f +Subproject commit 95fde1f07d4a67bb93964d7d58ff05d398702343 diff --git a/hugo.toml b/hugo.toml index 443fd019..b24e1229 100644 --- a/hugo.toml +++ b/hugo.toml @@ -398,6 +398,8 @@ enableEmoji = true hiddenFromSearch = false # FixIt 0.2.18-lts.5 | NEW whether to hide a page from RSS feed hiddenFromRss = false + # FixIt 0.3.0 | NEW whether to hide a page from related posts + hiddenFromRelated = false # FixIt 0.2.0 | NEW whether to enable twemoji twemoji = false # whether to enable lightgallery @@ -699,7 +701,7 @@ enableEmoji = true name = "" logoUrl = "" - # FixIt 0.3.0 | NEW Related content config + # FixIt 0.3.0 | NEW Related content config (https://gohugo.io/content-management/related/) [params.page.related] enable = false count = 5 diff --git a/layouts/partials/single/related.html b/layouts/partials/single/related.html index 68731706..97979b40 100644 --- a/layouts/partials/single/related.html +++ b/layouts/partials/single/related.html @@ -3,7 +3,13 @@ {{- $params := .Scratch.Get "params" -}} {{- if $params.related.enable -}} - {{- $related := .Site.RegularPages.Related . | first ($params.related.count | default 5) -}} + {{- $posts := where .Site.RegularPages "Type" "posts" -}} + {{- if .Site.Params.page.hiddenFromRelated -}} + {{- $posts = where $posts "Params.hiddenfromrelated" false -}} + {{- else -}} + {{- $posts = where $posts "Params.hiddenfromrelated" "!=" true -}} + {{- end -}} + {{- $related := $posts.Related . | first ($params.related.count | default 5) -}} {{- with $related -}}

{{ T "single.relatedContent" }}