r-lib / hugodown

Make websites with hugo and RMarkdown
https://hugodown.r-lib.org
Other
166 stars 24 forks source link

site_root() should maybe not (only) rely on config.(toml|yaml) #14

Closed jemus42 closed 4 years ago

jemus42 commented 4 years ago

For hugo sites, it's quite possible the site root does not contain a config.(toml|yaml), but rather a directory config/ with subfolders corresponding to environments.
See the hugo docs for examples.

I personally use this approach with only a config/_default folder purely because theme- and site configuration can become quite crammed if done in a single file, and I like the ability to divide "hugo stuff" into config/_default/config.toml and have theme-specific settings in config/_default/params.toml.

{blogdown} uses this same approach (determining site root by looking for config.toml), which is why I had to resort to a symlink.
That's not a big deal of course, but if the scope of this package is specifically to work with hugo, it might be worth it to find a neater solution.

The problem is that, while every hugo site root has to contain a config.* file or config folder, a themes directory and a contents directory — all these directory names can be configured arbitrarily (hugo options configDir, themesDir, contentDir).

The more I think about it, the more feasible it seems to just accept the minor caveat and expect a config.(toml|yaml), but I at least wanted to throw the idea out there.

hadley commented 4 years ago

hugo provides a bewildering array of possible config locations, and unfortunately I'm not prepared to support all of them for this project. So if you're using some configuration hugodown doesn't recgonise, you'll need to touch config.toml or similar.