getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
14.2k stars 970 forks source link

support themes in relative paths #2693

Closed awakecoding closed 2 weeks ago

awakecoding commented 2 weeks ago

Summary

I'm trying to create a git repository with more than one zola sites (a config.toml for a top-level site, and a different config.toml for individual sites generated multiple times from the same template). I wish to reuse the same theme without importing the same git submodule in two locations relative to the two config.toml files.

Proposed solution

Allow passing a relative path in the config.toml "theme" option, like this:

theme = "../themes/easydocs"

Where a relative path wouldn't assume it's loaded from "./themes"

Keats commented 2 weeks ago

We have a few checks around to make sure we don't load things outside of the site folder so that would go against that principle. That won't be added

awakecoding commented 1 week ago

Alright, no problem. I did figure out an acceptable workaround in git, for those facing the same kind of issue: it's possible to make a git submodule that refers to another git submodule, such that it is cloned only once, like this:

PS > git submodule status
 42af5af445c282886dda0808e6b71ddb903ea580 themes/easydocs (heads/master)
 42af5af445c282886dda0808e6b71ddb903ea580 top-level/themes/easydocs (heads/master)
PS > Get-Content .gitmodules
[submodule "top-level/themes/easydocs"]
        path = top-level/themes/easydocs
        url = git@github.com:codeandmedia/zola_easydocs_theme.git
[submodule "themes/easydocs"]
        path = themes/easydocs
        url = ./top-level/themes/easydocs