Overriding theme imported as a module?

I have cloned a hugo theme template directly from the source into my github repo. It is acquiring the template files as a module

path = "github.com/CaiJimmy/hugo-theme-stack/v3"

I need to edit theme a bit. For that I need directories like partials, layout etc. There are no such thing in my project as it import it as a module.

How do I import these file manualy and use theme localy from my project directory rather than importing it as a module ? If I want to alter only some files from the template, does creating these file structures in my project override the remote template files each time my site is built? Is there any drawbacks to this approach?


hugo mod vendor

…then look in the _vendor directory in the root of your project.

Copy the file you want to override to the same location in your project root.

1 Like

I didn’t do the vendor thing. I want to update the template later. So I just copied the partials folder with the file I want to edit. It’s working for now.

So you “do the vendor” thing to have access to the files, copy what you want, then delete the “_vendor” directory when you’re done. That allows you to hugo mod get in the future.

1 Like

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