3

Using Jekyll 2.5.3, I've tried to set default values in _config.yml (I'm just playing around to get a feel for it right now). I'm trying to set a default layout right now on a site I'm serving locally. I have set --watch and that's working fine. When I set any YAML defaults in _config.yml, Jekyll does not apply the defaults at all.

Here's the config file I'm currently using:

name: jekyll test
description: test server

url: "http://localhost:4000"

markdown: rdiscount
permalink: pretty

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

The default layout is not applied to any page. I've tried with the title as well, with the same result.

My index.md:

---
title: index
----

{{  page.title  }}

My default.html:

<style>
    body {
        background-color: black;
        color: white;
        font-family: "Helvetica", Arial, sans-serif;
    }
</style>

<body>
    {{  content  }}
</body>

The default layout works fine when put into the YAML Front Matter of the index page itself, the main reason I'm looking for this is so I can apply default.html to 404 pages. The other elements in config.yml aren't giving me any trouble. Is there something I've done wrong?

user1576628
  • 792
  • 3
  • 8
  • 25

2 Answers2

7

Fixed it myself - --watch does not listen for changes to files that aren't included in the site itself (namely _config.yml, which is used to generate pages at runtime). To apply changes to the site configuration, I just had to restart Jekyll and feel a little stupid.

Bottom line: I have learned my lesson. If changes don't appear to be saving, turn it off and on again before asking.

user1576628
  • 792
  • 3
  • 8
  • 25
0

I had this issue. There was an extra space after toggling a comment '#' tag in the frontmatter of my index.md:

---
#title: index
 title: index2
----

and I fixed it by removing the space:

---
#title: index
title: index2
----