I am trying to display items from a collection called fiction. Nothing other than the url is displaying on the website.
The for loop for collection is here
{% 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 %}
My _config.yml is written like this
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"
The markdown content is like this:
---
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
The same problem happens on individual collection page: The link to the project is here: http://thebookproject.team/experiment/fiction.html
The link to its github is here: https://github.com/thebookproject/experiment
Where exactly am I going wrong?
The problem lies within the front matter of the markdown files.
When I tried building the site locally, I got an error saying that front matter parsing failed:
caption: blah blah collections_dir: my_collections.
In this line, there are multiple variable declarations, caption:
and collections_dir:
. To fix this, try enclosing your caption in quotes, like this:
caption: "blah blah collections_dir: my_collections."
This fixed the build error for me.