Cannot grab second default value


I am trying to grab the value of theme-color from the defaults array, but to no avail. However, I am able to grab the author value.

path: ""
author: "ICanGrabThisValueButNotBelow"
theme: “ff3310”


Your variable names are different.

In your front matter default you named it theme and in the layout you’re calling theme-color. Name them the same and it should work.


Thanks. I updated the vars and rebuilt. The value is still blank. Anything else to try?


Yes, one obvious thing I missed. You’re setting theme-color as a Front Matter default therefore it is accessible through the page object, not site. So you would use page.theme-color instead.

site.theme-color would be used outside of the Front Matter defaults in your _config.yml, similar to title or url.


OK, that’s it. :slight_smile:So the below would hold true.

Global/Site-level Variables [in _config.yml]

author: "MyNameHere"
theme-color: "#ff3310"

{{ site.theme-color }}

Page-level Variables [also in _config.yml]

      path: "" # an empty string here means all files in the project
      theme-color: "ff3310"

{{ page.theme-color }}