Single theme file to spin multiple sites

Hi there

I have a custom admin panel where data is stored.

A Hugo theme hosted on GitHub which is used for multiple websites

Now question is: can I spin up multiple websites based on single theme without having to copy the theme files again and again. All websites are hosted on the same server

what will be the best way to have single theme file with multiple websites.

thank you in advance for taking the time

Use modules: Use Hugo Modules | Hugo

1 Like

Thank you @pointyfar

that was really helpful will try to do this now cheers!

Another option is to add the theme as a git submodule.

1 Like

Hi @zwbetz

thanks for the good advice I was Abel to integrate the GitHub theme to my project

but it seems like I have to manually update the project theme and also theme is loaded in each project

what I am actually trying to achieve is to have a theme copied once and then spin up multiple files using that single theme folder

is it something doable in Hugo?

If going the git submodule way, you cannot totally automate it.
But, you can script it to become a single step.
For example, I use this shell script in my personal site to grab the latest theme changes.

#!/usr/bin/env bash

git submodule update --remote --merge
git add --all
git commit -m "Theme changes"
1 Like

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