Unlist a single post (to create a secret page)?

Howdy partners!

Is there a way to unlist a single post from the range and results? So I can create a “hidden” page?

Just wondering.

Try something like

{{ $pages := where .Pages "Title" "!=" "Secret Page" }}
{{ range $pages }}

You could filter the secret page out by some param other than Title, just used that for an example

3 Likes

Where should I insert this code snippet? I am using Hugo with the academic theme.

Related issue documenting the need for a built-in feature: https://github.com/gohugoio/hugo/issues/6412

@ComFreek

You would be expected to have some general knowledge of modifying themes. You didn’t even specify the Page kind. Themes can be complex, with lots of partials or different layouts. Look here for a starting point:

As Kind or Type, for exemple?!
is it possible to use these rules in this way?

(because I think using Title for this, it’s not the more efficient, isn’it?!)

Correct.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.