Default layout in _config.yml ignored, when custom source specified (in same _config.yml file)

When I specify a custom source in the _config.yml file, the default (that previously worked fine), is no longer taken into consideration.

name: Test

source              : ./app/src
destination         : ./app/dist
layouts_dir         : ./_layouts
includes_dir        : ./_includes

  - scope:
      path: ""
      layout: "default" # this one is ignored!

When I specify the the same layout value in front matter, it does work:

layout: default
title: test

<main>hello, world</main>

But the whole point of having the option of specifying defaults is that I do not want to repeat myself in each and every html file.

Is this a bug? or is there something wrong with my _config.yml?

I’m not sure if it is relevant, but I use GitHub pages to deploy the project.

Possilby without the quotes around “default” in _config.yml?

unfortunately, that does not make a difference :frowning:

I wonder if you need to set the path to the new location? not how it should work but maybe that could fix it?

or maybe you need to have the layouts in the same place as the source? or maybe both.

I tried just about all the possible combinations. I can skip the layouts_dir and includes_dir, as they are the default values (they are relative to the source).

I also tried various variations for layout setting, such as ./app/src/_layouts/default and ./_layouts/default and tried with and without the extensions. It just doesn’t work :frowning:

I find it odd that it does work if I specify the same value in the front matter?

try doing it with --trace on the command and it may tell you where it is looking.

And to be clear the path I am talking about is in the defaults section under scope - maybe it needs to be ./app/src?


I don’t have a local install (I deploy to github pages) and I didn’t manage to get a local install on windows either (some dependency not building, exit code 2, yada yada).

I did try your suggestion though! but it does not solve the issue :frowning:

where did you see that there are config options for layouts and includes? the docs only show options for src and dest.

I see a build command to set the layouts directory but I don’t see that under the config section.

My guess is you can only set the src and dest in the config, and once you do that it is assumed that the layouts and includes are in the src directory.

I played around with that a bit and it did work properly, the layout set in the defaults did work. If I specified the layout and include files like you had then it never worked.

It is a complicated thing to test, a lot of moving parts and I was modifying an existing site that does some things differently so I am not sure I covered all the possibilities correctly.

Add on the fact you are doing it on GH pages may make it a bit more complex - they have something about a docs folder that you can use? not sure how specifying the src and dest on GH will work - I would not be surprised if it was locked down in some way.

Is your website source code public? If so, can you provide a link to the code? This feels like a bug but I’d like to reproduce it locally to confirm.

We setup a quick repo to showcase the issue in isolation:

Just remove the layout: default line from /app/src/index.html to see the config being ignored.