Allow disabling sections

The build time grows gradually as more content is added. Similar to the --disableKinds flag, I’d like to disable some inessential sections locally to reduce the build time.

Does setting the content as draft not solve the issue ?

1 Like

With v0.121.2 and earlier you could do this to disable rendering of an entire section:

---
# contents/section/_index.md
title: Section
draft: true
---

In the next release, setting draft to true as shown above will disable rendering of the section page only.

Use build options.

2 Likes

Yeah, that’s the temporary method I’m using, but I don’t like to mess up git output, such as git diff, git stutus.

Note that you can set build options in your site configuration, then “cascade” them down by targeting the paths of the relevant sections. That way the content files are untouched.

1 Like

Thanks a lot, will give it a try.

1 Like

Thank you all, I can manage to exclude some sections from local environment only. Post an example here, hope it helps.

cascade:
  - _target:
      path: /releases/*/**
    _build:
      list: never
      render: never

The example above excludes the releases section.

I’d suggest configuring it in config/development/hugo.yml (configuration directory), so that it won’t affect production environment even you’ve committed that configuration by mistake.

References:

2 Likes

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