YML内容不在Jekyll集合中显示

问题描述 投票:0回答:1

我正在尝试显示名为小说的收藏集中的物品。该网址上没有显示任何其他内容。

Screenshot of the website

用于收集的for循环在这里

{% for fiction_item in site.fiction %}
    <ul class="col-xl-3 col-lg-4 col-md-6 mb-4">
        <li class="bg-white"><img class="img-fluid card-img-top" src="{{ fiction_item.image_url }}" alt="{{ fiction_item.title }}">
            <div class="p-4 art-content">
                <h5>{{ fiction_item.title }}</h5>
                <h6>by {{ fiction_item.writer }}</h6>
                <p class="small text mb-0">{{ fiction_item.caption }}</p><a class="btn border-pretty" href="{{ site.url }}{{ fiction_item.url }}">More</a>
            </div>
        </li>
    </ul>
{% endfor %}

我的_config.yml是这样写的

name: The Book Project

url: '/experiment/'
baseurl: '/experiment/'

collections:
  nonfiction:
    output: true
  fiction:
    output: true
  art:
    output: true
  poetry:
    output: true

defaults:
  - scope:
      path: ""
      type: "nonfiction"
    values:
      layout: "blog"
  - scope:
      path: ""
      type: "fiction"
    values:
      layout: "blog"
  - scope:
      path: ""
      type: "art"
    values:
      layout: "blog"
  - scope:
      path: ""
      type: "poetry"
    values:
      layout: "blog"

降价内容如下:

---
layout: blog
title: History of India
image_url: https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Cave_26%2C_Ajanta.jpg/348px-Cave_26%2C_Ajanta.jpg
writer: Adnan Abbasi
caption: Whendefining a collection as a sequence, its pages will not be rendered by default. To enable this, output: true must be specified on the collection, which requires defining the collection as a mapping. For more information, see the section Output. Gather your collections 3.7.0. You can optionally specify a directory to store all your collections in the same place with collections_dir: my_collections. Then Jekyll will look in my_collections/_books for the books collection, and in my ...
---

When defining a collection as a sequence, its pages will not be rendered by default. To enable this, output: true must be specified on the collection, which requires defining the collection as a mapping. For more information, see the section Output. Gather your collections 3.7.0. You When defining a collection as a sequence, its pages will not be rendered by default. To enable this, output: true must be specified on the collection, which requires defining the collection as a mapping. For more information, see the section Output. Gather your collections 3.7.0. YouWhendefining a collection as a sequence, its pages will not be rendered by default. To enable this, output: true must be specified on the collection, which requires defining the collection as a mapping. For more information, see the section Output. Gather your collections 3.7.0. You

When defining a collection as a sequence, its pages will not be rendered by default. To enable this, output: true must be specified on the collection, which requires defining the collection as a mapping. For more information, see the section Output. Gather your collections 3.7.0. You When defining a collection as a sequence, its pages will not be rendered by default. To enable this, output: true must be specified on the collection, which requires defining the collection as a mapping. For more information, see the section Output. Gather your collections 3.7.0. YouWhendefining a collection as a sequence, its pages will not be rendered by default. To enable this, output: true must be specified on the collection, which requires defining the collection as a mapping. For more information, see the section Output. Gather your collections 3.7.0. You

单个收集页面上发生相同的问题:enter image description here该项目的链接在这里:http://thebookproject.team/experiment/fiction.html

指向其github的链接在这里:https://github.com/thebookproject/experiment

我到底在哪里出错?

jekyll github-pages liquid
1个回答
0
投票

问题在于降价文件的首要问题。

[当我尝试在本地构建站点时,出现错误,表明前端问题解析失败:

caption: blah blah collections_dir: my_collections.

在此行中,有多个变量声明,caption:collections_dir:。要解决此问题,请尝试将标题括在引号中,如下所示:

caption: "blah blah collections_dir: my_collections."

这为我解决了构建错误。

© www.soinside.com 2019 - 2024. All rights reserved.