Hi, I’m new to using hugo and I’m trying to get a sense of whether I can combine elements of two themes in the same site. Ideally I’d like to have most of the site follow the academic theme, but I’d like to insert the Hugrid theme to create a “people/staff” section you would see on most company websites. Would this be possible?
Yes, you can apply a different template to a different section. Note that, you can use no theme at all, simply by including the requisite theme elements in your templates. Looking at the docs, you’ll see that there is an order with which hugo applies the templates it finds. There’s nothing that says you can assign different css or page structure to a different page.
Thanks for your response, Rick! Perhaps I’m not clear between the terms “page” and “section.” In the academic theme all the content seems to be on one page, in multiple sections. How would I assign a different theme template to one section? For example, I’d like to change the theme of the “about” widget to the hugrid format or create a custom one.
On this page it seems the theme for the entire site is specified in the config file: https://gohugo.io/templates/lookup-order/. Would I need to combine config files for both academic and hugrid themes?
There is no way I know of to specify two themes for a hugo site, so this is a manual copy-paste exercise to give a specific page another look.
One way would be to specify your “main” theme for most pages in the usual way, then specify a different one (probably via a different css etc loaded in a
<head> section specific to what you want for that theme) for the page or section.
You can set a
layout variable in a page’s frontmatter to pick a specific template for that page. The template would need to be set up to have the look you want.
You can also specify a template per section.
The docs cover all this but you kind of have to read all of them to have that aha moment. A good starting point:
I wanted to add, @eboyd2, combining two themes: totally doable. But some find a steep learning curve for Hugo templating, and one will need to have experience with templates to merge two of them. Basically, you are building a new theme from reusable templates that need to be customized for the merge. So unless you are interested in rolling your own theme, I’d suggest against it.
I want to double-down on encouragement, because that wasn’t my point. I just got the sense you thought we’d be able to knock this out in a couple back and forths.
Doing what you are talking about is an excellent way to learn. But it does mean you will need to read every page of the docs, four times.
That isn’t a hard rule, but we’ll totally know!
Read through all the theme docs, and then ask pointed questions about specific problems.
For instance, it sounds like you just want the staff grid part from one theme into another. If that is the case, figure out how that grid is created, isolate the code, pull it out and see what needs to be done to make it work in the other theme. Lots of research, but those are yer next steps.
eboyd2, did you complete this project? I’d also like to attempt something similar. I’m a Hugo newbie and could use all the help I can get!