I want to hide one post from its section’s list page, but include it in the previous and next posts list in single.html
. Setting the build option to list: never
removes the post from the page navigation. Is this possible? (all the posts have weight set in front matter).
Exclude the page while ranging through the collection.
{{ $pageToExclude := .GetPage "/posts/post-2" }}
{{ range site.RegularPages }}
{{ if not (.Eq $pageToExclude) }}
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ end }}
{{ end }}
1 Like
Do you mind explaining how this works? I was close to your solution, but using if not $PageToExclude
, which removed all posts from the collection.
{{ range site.RegularPages }}
// within the range, the context (the dot) is a page
{{ end }}
.Eq $pageToExclude // .Eq is a method on .Page to compare the page to another page
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.