Data Collections
To fill the blogs, or article in every categories. Eleventy construct collections of contents. Lets see the example article inside the collection, where
Inside content
folder, this is where we fill the contents inside the templates. As you can see
Syntax Markdown
---
tags: blog
title: Hot Take—Social Media is Considered Harmful
---
This will place this mypost.md
into the post
collection with all other articles of content that same tag post
.
In our Tulip Theme, we have two different collections journal
and blog
.
./src
└── content
├── journal
├── blog
For the blog
we just put tags blog
in every markdown article inside our folder link blog
.
Same with journal
where the markdowns are inside folder journal
.
To list the collections of blog
let's say, use the collections
object inside our nunjucks file index.njk
Syntax Nunjucks
<ul>
{%- for article in collections.blog -%}
<li>{{ article.data.title }}</li>
{%- endfor -%}
</ul>
Content structure
content
└── about
└── blog
└── docs
└── help
└── journal
└── landing-dark
└── landing-light
└── portfolio
└── preview
└── terms
└── 404.md
└── index.njk
about
: About pageblog
: Blog page with article contentshelp
: Help Pagejournal
: Journal Pagelanding-dark
: Landing page with dark backgroundlanding-light
: Landing page with light backgroundportfolio
: Portfolio page with project contentspreview
: Showcase preview pageterms
: Sample terms service page404.md
: page not foundindex.njk
: Home page
Coming soon for more layouts