Getting headless to be headless

I am pretty sure I misunderstand how headless works.

I have the following folder structure:

/content/folder1
/content/folder2
/content/sitewide/authorfooter/index.md
/content/folder3

the index.md of authorfooter has a front matter headless: true.

The documentation (https://gohugo.io/content-management/page-bundles/#headless-bundle) says:

Only leaf bundles can be made headless.

and

A headless bundle is a bundle that is configured to not get published anywhere

It does though :wink: Running hugo on my repo creates a folderstructure for sitewide in my site. What am I overlooking? The authorfooter is a widget I embed in all pages in the sidebar. Don’t ask why it’s called footer and in the sidebar. “This theme developed organically ;)”

Is there any way tell hugo to ignore the whole folder sitewide, but have the pages below available for {{ with .Site.GetPage "sitewide/authorfooter.md" }}?

(I tried /content/sitewide/authorfooter.md before I saw that “leaf bundles” part above. Same result.)

A step further:

I remembered the config.toml parameter to disable rendering of “kinds”. sitewide is not a leaf bundle, authorfooter is. So treating sidewide as a post type and disabling in config.toml via

disableKinds = ['sitewide']

should do what I want, but doesn’t either.

It looks like Hugo is creating the home page in this subfolder, not the authorfooter as a page. I might have a much different problem than assumed.

The repo is https://github.com/davidsneighbour/samui-samui.de.

That stament is no longer true.

Other than that, I’m not sure what’s happening in your project.

Check out this discussion

But basically try adding _index.md to /content/sitewide/ with the following frontmatter

url: "/"

It’s a work around, but unfortunately Hugo doesn’t let you disable list pages for specific directories at this time. (At least not to my knowledge)

disableKinds doesn’t take post types as parameters you can only input the following options "page" , "home" , "section" , "taxonomy" , "term" , "RSS" , "sitemap" , "robotsTXT" , "404".

then can someone explain to me WHAT kind of pages headless works with ?
It doesn’t with a leafless bundle here. I have the directory “kiddy_girl/” with _index.md = "--- headless: true bookhidden: true ---"
I don’t need it to appear or be published, it’s one only role is to host a bunch of (published) pages to call upon from other pages.
But it still appears as a menu item !

headless page bundle only works in leaf bundle. it should be kiddy_girl/index.md

1 Like

Ah I see so it’s useless to me since my non-page resources are all under static/.
just having bookhidden: true works.
Thanks.