jekyllliquidyaml-front-matter

Jekyll - How to change default layout for specific paths


I'm trying to create a default configuration that changes the layout of pages under a specific directory using the path variable in the _config.yml file, that way:

collections:
  biterbo-product:
    output: true
  v11-3:
    output: true

...

defaults:
  -
    scope:
      path: ""
    values:
      layout: "default"
  -
    scope:
      path: ""
      type: "v11-3"
    values:
      layout: "documentation"
      versionDir: "11.3/"
  -
    scope:
      path: "_v11.3/eye-product"
      type: "v11-3"
    values:
      layout: "docueye"
      versionDir: "11.3/"
      mainPage: "eye-product"

And my filetree looks like this:

_config.yml

_v11-3/eye-product/page-eye1.md

_v11-3/eye-product/page-eye2.md

_v11-3/oculus-product/page-oculus.md

So, I want for _v11-3/eye-product/xxx pages to have the "docueye" layout while other pages inside _v11-3/* have the "documentation" layout. But, it's not working. Instead of that, every page inside /_v11-3/ have the "documentation" layout, even /_v11-3/eye-product/*. Seems that the path clause in the defaults is not working.

Every page inside /_v11-3/ has a permalink which is "/11.3/xxx" in their frontmatter. I think this is not important here, but...

I don't know what am I doing wrong, so I would need a little help here. Thank you in advance.


Solution

  • The path directive must reference the real directory without initial nor trailing backslashes.

    In this example, the path should be path: "_v11-3/eye-product"