Hi, new to Hugo but almost ready to launch my site. I’m currently using the re-terminal theme and have made some of my own changes/additions with the theme as a git submodule.
To keep the ability to pull new changes from re-terminal and continue to have my own changes remain, is the best way to do this a branching strategy like here? Making sure before I get all that going lol.
I am very interested in using Hugo Modules instead of the project + submodule theme setup if the Hugo/Go modules method makes this updating/merging easier. Haven’t read enough on it but if anyone more experienced can vouch for that being better in my case (have a third party theme but want heavy customization ability as a dev) I’m willing to pivot.
Thank you for any info! Happy to answer questions if needed.
With this theme structure:
themes/
└── foo/
└── layouts/
└── _default/
├── baseof.html
├── home.html
├── list.html
└── single.html
If you want to override home.html, copy it to the same path relative to the root of your project.
layouts/
└── _default/
└── home.html <-- overrides themes/foo/layouts/_default/home.html
themes/
└── foo/
└── layouts/
└── _default/
├── baseof.html
├── home.html
├── list.html
└── single.html
Use this approach regardless of how you add themes to your project. Never modify a theme—override instead.
Ah, that’s exactly what I needed! Basically what’s the best practice as I didn’t think messing with it directly made a lot of sense. I guess I’ll forego the modules thing for now since this is a straightforward and working approach. Thanks!
Didn’t think to ask this follow up till now, but what about modifying styling/CSS vs. the layouts/templates? IS this also a case I can override what’s in the theme? If so, where does that CSS go (or if it’s a docs page I missed, link is also great lol)?
Use the same approach to override anything in the following directories:
- archetypes
- assets
- content
- data
- i18n
- layouts
- static
Be sure to read your theme’s documentation for specifics… some themes have a preferred mechanism for adding/overriding CSS.