Can some config.yaml properties be set in the theme?

There are many properties that I have to set in the config.yaml file for my theme to work. These are settings that the average user of the theme should never have to worry about. Ideally I would set those properties in /themes/<mytheme>/config.yaml.

The behavior I would expect is that any property in the theme’s config.yaml would be overwritten by a property in the /config.yaml file at the root of the project when they get merged into the final configuration for the site.

I’ve tried doing this any it seems to just ignore the properties in /themes/<mytheme>/config.yaml.

I’m fairly certain the answer to this question is “Not possible” … but I thought I’d ask :slight_smile:

Not possible, and this is a good thing.

Although I have a lot respect for theme developers, I would prefer that they leave site configuration to me. A small mistake by a theme developer could easy break my site when I update a theme. For example:

staticDir = "statc" 
theme = "" 

They could also inadvertently make serious changes that would be less visible:

  1. Change my Google Analytics site ID
  2. Disable a portion of Hugo’s security model by setting Goldmark’s rendering option to unsafe = true

There are some properties that can be set, but it’s limited.

In my case our website is the only consumer of the theme … I do this because I don’t want the content authors to have too complex of a repository (and less opportunity to muck things up). I’ve setup our CI/CD system to check out the content and theme from separate repositories before building. The config.yaml file is the only file that they might muck up … which is why I wish I could store it in the Theme repository.

As I write this now, I see that I could just as easily have the CI/CD system “move” the config.yaml file from the theme repository into the root directory as part of the build that we already have. :slight_smile:

@jmooring thanks for helping me think this through!

Just for my own knowledge … could you share what they are and how I could configure them in the theme? (if this is already in the docs I apologies)