Use two themes on one site

Hi,

I have been looking around and I cannot find anything on how to do this, so not sure if it is even possible.

I want to have two themes on a site. An example would be:
Default theme for site is - MyTheme
Just for the About page I want it to use CoolAboutTheme

So assuming both of those themes work well individually, is there a way to make just one page of my site use a different theme than the default?

1 Like

You can’t have two themes for one site. But you can have layouts for your sections. And you can transform the coolabouttheme to a layout just for the about section. Your about section is rendered by anything inside of layouts/about/. single.html will render single pages, section.html will render domain.ext/about.

2 Likes

@davidsneighbour , I think it is conceptually right and valid.

@tehnerd How about making a custom .css file for that page of his choice alone? Just a tweak…

Cheers,
RM…

1 Like

As been mentioned, two themes no, layouts yes. And same is for CSS.

main layout got in head

  {{ $style := resources.Get "css/masterstyle.css" | minify | fingerprint }}
  <link rel="stylesheet" type="text/css" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}" media='all' />

Than layouts, for example:

    {{ if .Params.difflayout }}
      {{ partial "article-layout-2.html" . }}
    {{ else }}
            {{ partial "article.html" . }}
    {{ end }}

Then each article file contains a reference to their styles (ps. Style not necessary need to be loaded in HEAD).

for example in article-layout-2.html

  {{ $style := resources.Get "css/layout2style.css" | minify | fingerprint }}
  <link rel="stylesheet" type="text/css" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}" media='all' />

Just a rough idea.

2 Likes

Nice idea. Thank you @idarek !!

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