Hugo fails to identify "posttype" of mounted content

This is a weird thing and I am pretty sure I overlook something small…

My website has a section documentation. I want to hide the documentation from the live site, so I moved it out of the content folder and then mounted it in its old place. Starting then Hugo stopped acknowledging the “posttype” of those documentation pages.

“posttype”: I have a system implemented where in data/.../theme.toml I have sections like this:

[types.documentation]
related = false
comments = false
banner = false
headline = false
bannerheadline = true
meta = false
transform = ["headline", "content", "preview"]

that configures how posts are shown in sections (features, order, etc.). My “posttype” is currently the name of the section (first level of the URL after the domain name).

Before moving the documentation folder out of the content folder, the website worked fine but showed the documentation. My idea is to have a mount via config/development/modules.toml so it’s not shown or included in live site page collections.

The error is this:

Error: error building site: render: failed to render pages: 
render of "page" failed: 
"/home/patrick/github.com/davidsneighbour/hugo-modules/modules/errors/layouts/error/single.html:8:21": 
execute of template failed: template: error/single.html:8:21: 
executing "main" at <partials.Include>: error calling Include: 
"/home/patrick/github.com/davidsneighbour/kollitsch.dev/layouts/partials/content/post.html:63:11": 
execute of template failed: template: partials/content/post.html:63:11: 
executing "partials/content/post.html" at <partial "content/components/meta.html" $post>: 
error calling partial: 
"/home/patrick/github.com/davidsneighbour/kollitsch.dev/layouts/partials/content/components/meta.html:4:18": 
execute of template failed: template: partials/content/components/meta.html:4:18: 
executing "partials/content/components/meta.html" at <partialCached "func/getPostSetup.html" $posttype>: 
error calling partialCached: 
"/home/patrick/github.com/davidsneighbour/kollitsch.dev/layouts/partials/func/getPostSetup.html:6:10": 
execute of template failed: template: partials/func/getPostSetup.html:6:10: 
executing "partials/func/getPostSetup.html" at <$posttype>: 
invalid value; expected string

I added a warn $posttype immediately before the error occurred, and it seems that Hugo has documentation as a value. One line later, this fails.

Any suggestion as to where to dig for the reasons of this mess is welcome.

Could it be connected to my older issue of templates.Exists not working for mounted folders?

quick check - you are at least missing the default mount for content

[[mounts]]
source = "content"
target = "content"

[[mounts]]
source = "documentation"
target = "content/documentation"

I think that was it :wink: I’ll get back to you when I am done banging my head at the wall and tested it a little bit, but it seems to be working now.

1 Like

You were right… Thanks for the suggestion. It’s often the small things that I overlook :smiley:

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