Config directory not working with Hugo theme(module)

The release notes for v0.84 mention that Hugo modules and themes can use the Configuration Directory. However, I could not get this to work.
I added my theme in my site’s config as follows:

theme: github.com/UtkarshVerma/hugo-yami

module:
  imports:
    - path: github.com/UtkarshVerma/hugo-yami

What’s weird is that Hugo does detect that folder, but the configurations aren’t applied.

❯ hugo server
Start building sites … 
hugo v0.84.0-2C4689F7B+extended linux/amd64 BuildDate=2021-06-18T17:14:27Z VendorInfo=gohugoio

                   | EN  
-------------------+-----
  Pages            |  1  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  0  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  0  
  Cleaned          |  0  

Built in 0 ms
Watching for changes in /home/subaru/GitHub/utkarshverma.github.io/{assets,data,package.json}
Watching for changes in /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!utkarsh!verma/hugo-modules/bootstrap-v5@v0.0.0-20210617175124-702299e638f4/_vendor/github.com/popperjs/popper-core/{index.d.ts,lib,package.json}
Watching for config changes in /home/subaru/GitHub/utkarshverma.github.io/config.yaml, /home/subaru/GitHub/utkarshverma.github.io/go.mod
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

If I copy the config folder from my theme to website, then the website builds fine.

❯ hugo server
Start building sites … 
hugo v0.84.0-2C4689F7B+extended linux/amd64 BuildDate=2021-06-18T17:14:27Z VendorInfo=gohugoio

                   | EN  
-------------------+-----
  Pages            |  3  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  0  
  Processed images | 38  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Built in 1080 ms
Watching for changes in /home/subaru/GitHub/utkarshverma.github.io/{assets,data,package.json}
Watching for changes in /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!utkarsh!verma/hugo-modules/bootstrap-v5@v0.0.0-20210617175124-702299e638f4/_vendor/github.com/popperjs/popper-core/{index.d.ts,lib,package.json}
Watching for config changes in /home/subaru/GitHub/utkarshverma.github.io/config.yaml, /home/subaru/GitHub/utkarshverma.github.io/config/_default, /home/subaru/GitHub/utkarshverma.github.io/go.mod
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

This weird behaviour seems to be caused by definition of disableKinds in my theme config.

disableKinds:
  - page
  - section
  - taxonomy
  - term

Moving this section to the website’s config fixes the build.

But this leads to another question. How do I properly configure disableKinds via theme’s configuration. I am doing this because my theme doesn’t use these “Kinds” and it’s a good practice to implicitly have these disabled in the theme itself.

Fixed it by specifying _merge: shallow at top-level in my website’s config.yaml. More info can be found here: Configure Hugo | Hugo

1 Like

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