HUGO

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".