Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use multiple themes on one website jeykll

I have recently found out about jekyll, and want to make a project landing page with it. I would like to have a home page using one theme (e.g. ubuild) and have another page for the docs (accessed via a navigation bar at the top) that uses a different theme (e.g. just-the-docs). How can I go about doing this?

EDIT: I want to use Github Pages for this.

like image 679
Monolith Avatar asked Oct 06 '19 21:10

Monolith


People also ask

How do I override Jekyll theme?

However, you can override any of the theme defaults with your own site content. To replace layouts or includes in your theme, make a copy in your _layouts or _includes directory of the specific file you wish to modify, or create the file from scratch giving it the same name as the file you wish to override.

How do you customize Jekyll?

You can add custom css and html files into your Jekyll site. @import "{{ site. theme }}"; Then any custom css can be put after these lines in this file and it will be included in your site.


2 Answers

Since you plan to use one of the themes on just a single page, I think the best solution would be to use two base layouts instead of two themes.

It will take some minor work initially, but will greatly ease future maintenance.

First set up the site to render just-the-docs theme for all pages including the landing page. Then modify _layouts/home.html to be a parent layout (like the default layout) to render the markup from the ubuild.. theme.

like image 175
ashmaroli Avatar answered Sep 30 '22 11:09

ashmaroli


I solved this with help from @JoostS's answer but with a few modifications:

  1. Make an organization on GitHub pages with a repo called <org-name>.github.io. This repo should contain the theme for the home page (ubuild in my case) and all the content for it.

  2. Make another repo with a jeykll site, called docs. This site should have the theme you want for the other page (just-the-docs in my case) and all the content along with it.

  3. In the docs repo, add baseurl: "/docs" to your _config.yml

  4. The <org-name>.github.io repo, should now be hosted at <org-name>.github.io/:

    Site is published

  5. The docs repo should now be hosted at the <org-name>.github.io/docs url:

    Docs repo

  6. To link to the docs page, you should just be able to use /docs now.

like image 34
Monolith Avatar answered Sep 30 '22 10:09

Monolith