Is there a way to generate only a particular file or subset of files or exclude certain files?

As an example use case, I have a JSON site index that I generate using a Hugo template for use by various other programs, but this adds significant overhead to the build time and I really only need it updated once a day, whereas my other regular posts might require to be generated a few times a day. I would like to be able to generate my site without this index for my normal deployment, then have a separate job to generate only that file once per day. Is such a thing possible?

You can try using different config files or directories.

One for your normal deployment that does not have the JSON output format defined and one that does.

Then in your deploy script you can call each config -as needed- with either one of the following CLI flags:

--config string          config file (default is path/config.yaml|json|toml)
--configDir string       config dir (default "config")

How can I specify in the config file which files to include/exclude in the generation? Do I need to have a separate layouts dir?

Use and in one config don’t generate JSON. In another, only generate JSON.

Please see the ignoreFiles parameter:

Thanks! I’ll try these out