Jekyll - YAML Front Matter Defaults not working

不想你离开。 提交于 2019-12-24 12:43:49

问题


I have a multi-site Jekyll project with folders for each site, slc, and la.

However, my YAML Front Matter defaults are not working. None of the default values--including the layout, crucially--are being transmitted to my templates:

//config.yml:

defaults: 
  -
    scope:
      path: "la"
    values:
      layout: "default-la"
      title: "Store Title"
      email: "email@gmail.com"
      baseurl: "" # the subpath of your site, e.g. /blog/
      url: "http://url.com"

// Folder structure

├───assets
│   ├───images
│   └───js
├───css
│   ├───bootstrap
│   │   ├───css
│   │   ├───img
│   │   └───js
│   └───font
├───la
│   ├───assets
│   │   └───images
│   └───css
│       └───css
│           ├───bootstrap
│           │   ├───css
│           │   ├───img
│           │   └───js
│           └───font
├───slc
├───vendor
│   └───js
├───_includes
├───_layouts
├───_sass

// _layouts/default-la.html

<!DOCTYPE html>
<html>

  {% include head.html %}

  <body>

    {% include header-la.html %}

    <div class="page-content">
      <div class="wrapper">
        {% include menu-la.html %}
        {{ content }}
      </div>
    </div>
    {% include js.html %}
    {% include footer-la.html %}

  </body>

</html>

//la/index.html

<div class="home">
    STUFF
</div>

回答1:


Add a front matter to la/index.html

---
---
<div class="home">
    STUFF
</div>

Now your default settings will apply.



来源:https://stackoverflow.com/questions/32281093/jekyll-yaml-front-matter-defaults-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!