Headless pages (without a bundle)?

Short version: Is there an easy way to make an arbitrary page “headless” (not show up in search, lists, …)?

The documentation clearly states “only page bundles” - of course, I had to experiment to actually realize this (https://github.com/gohugoio/hugo/issues/5517 helped).

So, if I understand correctly headless:true only really works on files named index.md (which are in subdirectories, and therefore “page bundles”).

Is there some way for me to mix headed and headless pages in a single directory?

I’d like to have a section (directory) with a _index.md (it is a list page), a bunch of pages that are listed (say a.md, b.md, c.md) and some pages that are not listed (say, shared.md) that those pages refer to, but do not appear by themselves.

I have achieved this by making a subdirectory with an index.md file (that has no content other than frontmatter headless: true, and putting shared.md in that subdirectory. But I was hoping I could keep a.md, b.md, and shared.md all together.

I would also understand the argument that I shouldn’t want this: that it is better data management practice to keep the headless pages in a separate place.

You can use Build Options

2 Likes

Thanks!

Guess I need to use build.render/build.list rather than headless. What I really need to do is wrap my head around all the options (since it’s no longer just a yes/no).

For future reference (to those with the same question, and to check my understanding)…

To achieve the effect that one expects from

headless:true

one can use:

_build:
 list: false
 render: false