Any way to prevent builds for a specific section?

I am working on a theme which has two modes. In one mode, the site is built as a blog while in the other, it is simply built as a sort of redirection single page. Both views work through two separate sections, namely cards and posts. I want to be able to configure Hugo through config.toml such that one of the two section isn’t built(or gets disabled). Is there any way to do that?

This is my theme, for reference purposes: https://github.com/UtkarshVerma/hugo-dream-plus

Checkout the docs on headless bundles

I do use the cards section for the frontmatter so I don’t think headless bundles will help me.

Well. This would be a headless page bundle with some .md files in it. Those .md files would be your cards.

Cards you could retrieve with (.Site.GetPage "cards-bundle").Resources.ByType "page"

Then you’re free to range them, where them just like any page collection.

i have done this this way

where .Data.Pages "Section" "not in" (split .Site.Params.invisibleSections ",")

in my config file:

[Params]
    invisibleSections   = "menu,intern,test"
4 Likes

Your solution seems relevant, I’ll try it out and update here.

To clarify, I am not looking for a workaround, I just want to disable a section during build. Using page bundles would be troublesome for me since I don’t want to spend much time developing right now(or rather, I can’t), therefore I’d like to know if it’s possible to do so with respect to sections alone.