【问题标题】:Jekyll Front Matter Path Doesn't WorkJekyll Front Matter Path 不起作用
【发布时间】:2019-01-27 01:01:05
【问题描述】:

我的网站有两个部分,introcore,我希望有两个不同的导航栏。

这是我的 navigation.yml

main:
  - title: "Intro"
    url: /intro/intro

  - title: "Core"
    url: /core/core-1

intro:
  - title: Introduction
    children: 
      - title: Intro
        url: /intro/welcome

core: 
  - title: Core
    children:
      - title: Core
        url: /core/core-1

这里是_config.yml

的相关部分
defaults:
  - scope:
      path: "intro"
      type: pages
    values:
      layout: single
      classes: wide
      sidebar:
        nav: "intro" 
  - scope:
      path: "core"
      type: pages
    values:
      layout: single
      classes: wide
      sidebar:
        nav: "core"

我的目录结构是:

/_pages/intro/welcome.md
/_pages/core/core-1.md

这会导致导航都不显示。这是怎么回事?

【问题讨论】:

  • 我认为您需要开发一个_include 文件,该文件会遍历您的导航数组。如果您仍有问题,请向我们展示布局文件。

标签: jekyll yaml-front-matter


【解决方案1】:

Michael Rose 在他的 github 问题页面 here 上回答了这个问题。

它不起作用,因为我的路径错误。为了完成这项工作,我必须在文件夹名称之前添加 _pages/。

defaults:
  - scope:
      path: _pages/intro
      type: pages
    values:
      layout: single
      classes: wide
      sidebar:
        nav: "intro" 
  - scope:
      path: _pages/core
      type: pages
    values:
      layout: single
      classes: wide
      sidebar:
        nav: "core"

【讨论】:

    猜你喜欢
    • 2015-11-23
    • 1970-01-01
    • 2015-08-17
    • 2019-03-13
    • 2017-06-19
    • 1970-01-01
    • 2015-05-12
    • 1970-01-01
    • 2018-06-25
    相关资源
    最近更新 更多