Search code examples
jekyllgithub-pagesjekyll-theme

Why are jekyll pages in subfolders not using my theme


I am using Jekyll to create a website on GitHub Pages. I have a _config.yml file with the following contents (this is the entire file):

theme: jekyll-theme-leap-day

collections:
  tutorials:
    output: true

I have a few dozen pages in my root folder, and a _tutorials folder which contains about 10 more pages. If it matters, all of my pages are MarkDown (.md extension).

All pages in my root have the proper styling (one of GitHub's built-in themes "Leap Day"). However, all of my subpages have a white background and are left-justified - it seems the theme is not applying there.

The only front matter in any of my pages is where I either specify the title: or (both in the pages in the root and subfolders).

Is there some setting I have to place in my _config.yml to tell the pages in _tutorial to use the same theme as the pages in my root folder? Do I need to put some Front Matter on each page to have it use the theme?

I tried adding the theme explicitly under the tutorials: section in my _config.yml but my tutorial pages still didn't use the theme.


Solution

  • Each theme comes with a specific set of layouts, chances are that your posts aren't using any of the new layout themes, so you need to check if them have a layout key in front natter specifying which layout to use, and change it to make your posts use a specific layout, or define a default layout to use when no layout key is present in posts adding a default value in _config.yml.

    Update

    Add the default layout to all of your pages in _config.yml:

    defaults:
      - scope:
          path: ""
        values:
          layout: default
    

    That should fix the issue.