Multiple themes per site

#1

I was looking at the newly announced Reveal theme for Hugo and it got me wondering if it would be possible to have multiple themes per site.

I could see a site having a main theme, then a secondary theme such as Reveal just for a sub-directory or matching path.

In this specific case I would have my main theme for all my pages, then specify (in config, or frontmatter maybe) that sub_theme_matching = "/presentations/prez*" would use the Reveal theme. Then paths matching that would use the specified theme.

This content would then use the Reveal theme:

content/presentation/talk-on-cats
content/presentation/talk-on-dogs

I see this as being useful to apply the Revel presentation theme just to presentation content, without having to built it into my own theme.

Would it be a difficult change to Hugo to have it match and use different themes?

What other scenarios would this be useful for?

Is there an easier way to achieve a secondary theme for a sub-path?

0 Likes

#2

I don’t have anything to contribute to a multiple themes discussion, but I did want to note it is probably fairly easy to add reveal.js to your site. Themes and sections templates, they are very flexible, so it is possible to load entirely different elements in both design and content, but it doesn’t follow the traditional idea of a “theme”. :slight_smile:

0 Likes

#3

You can’t do it with the theme mechanism per se but, you can change the templates however you want, to get whatever look per page or per section etc.

I have a different color for different parts of my site.

I specify which layout using layout: blahblah in frontmatter.

0 Likes

#4

Yes this is possible by creating a custom layout. But it would be much easier on the end user if they could just download a second theme, and add a configuration option.

Thanks for the note. I’d not heard of Reveal before seeing the Hugo Reveal theme.

0 Likes

#5

Urm, probably not, no. Because you then have to maintain changes in 2 themes when you won’t need the majority of one of the themes.

0 Likes

#6

FYI, this may be relevant: https://github.com/gohugoio/hugo/issues/4460

2 Likes