Hi I’m new to Jekyll and have a basic blog set up. Now my idea is to loop through a collection per blog post to get some fancy HTML going on. Because as far as I’m aware you can’t simply add HTML to the markdown.
// config.yml
collections:
- hollowknight
So I’ve set up a collection named hollowknight
and I got a blog post about Hollow Knight.
In the Front Matter of the blog post I have collectionid: 'hollowknight'
. And in the Layout I use for blog posts I tried the following:
// post.html
{% capture collection %}site.{{ page.collectionid }}{% endcapture %}
{% for section in collection %}
{{ section.title }}
{% endfor %}
So the idea was to set the collection
variable to site.hollowknight
as configured in the config and the Front Matter. I set up a single article inside the collection, but it isn’t showing up.
Is there any way to realise this?
Or is there a way to use paragraphs in the Front Matter, because then I could just use arrays and objects in the Front Matter of the posts to do my magic?
Or am I just stretching to far from what Jekyll is supposed to be?
Edit
So it would be possbible with Front Matter arrays and objects: https://github.com/jekyll/jekyll/issues/246#issuecomment-1639375
sections:
- title: section 01
videoid: 193641463
content: |
# Lorem Ipsum
is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
# It has survived
not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
But can’t get | textilize
to work.
Edit
So I found out I was getting the collection the wrong way, List collection with name from front matter.
{% for section in site.[page.collectionid] %}
{{ section.content | textilize }}
{% endfor %}
The only weird part is, everywhere I see | textilize
being used but can’t get it to work.