Zero configuration blog features for Eleventy: a paginated blog, tags, categories, and a year and month archive.
Works with Eleventy 3 (Node.js 18 or later) and the Eleventy 4 alpha (Node.js 22.15 or later).
Website: sielay.github.io/eleventy-plugin-blog,
built with the plugin itself. Its source is in site/.
- Tags, Categories and API to create new taxonomies (paginated)
- Calendar (paginated)
npx eleventy-blog adds the plugin to a site, writes and publishes
posts, tidies tags, and checks the site before a deploy. See
cli/README.md.
npm install --save eleventy-plugin-blog
# OR
yarn add eleventy-plugin-blogGo to the folder with given example and run:
../../generate-examples.js -o . -n 500
npx @11ty/eleventyThe script writes 500 sample posts, and Eleventy builds every index for them.
See the zero configuration example. Add the plugin to your Eleventy configuration file.
// eleventy.config.js
import blog from "eleventy-plugin-blog";
export default function (eleventyConfig) {
eleventyConfig.addPlugin(blog);
}CommonJS configuration files work too:
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(require("eleventy-plugin-blog"));
};The plugin treats every template under <input>/blog/ as a post, where
<input> is your Eleventy input directory. Add posts there and build.
The plugin adds the blog pages for you:
| Page | URL |
|---|---|
| Post list, paginated | /blog/, /blog/page-2 |
| Tag list | /blog/tag/ |
| One page per tag | /blog/tag/<slug>/ |
| One page per category | /blog/category/<slug>/ |
| Year and month archive | /blog/2026/, /blog/2026/07/ |
Atom feed, when feed.url is set |
/blog/feed.xml |
It also produces these collections, for your own templates:
blogall posts, paginatedblog_flatall posts, flatpagesall pages with front matterstaticPage: truetagposts grouped by tags, paginatedcategoryposts grouped by categories, paginatedcategory_listlist of all categoriestag_listlist of all tagscalendarposts grouped by year or year and month, paginated
Posts with draft: true in their front matter stay out of every
collection.
Eleventy makes a collection for every tag, such as collections.food.
The plugin's tag pages do not need them. On Eleventy 4, you can turn them
off:
export const config = {
keys: { tags: false },
};The built-in pages use a plain layout. Pass layout to use your site's
layout instead:
eleventyConfig.addPlugin(blog, {
layout: "base.njk",
feed: { url: "https://example.com", title: "My blog", author: "Ada" },
});To replace one page, create a file at its path in your input folder. The plugin then skips its own version of that page.
| Page | Path to create |
|---|---|
| Post list | blog-pages/index.njk |
| Tag list | blog-pages/tags.njk |
| Tag page | blog-pages/tag.njk |
| Category page | blog-pages/category.njk |
| Archive | blog-pages/calendar.njk |
| Feed | blog-pages/feed.njk |
To turn pages off, pass pages: false for all of them, or name the ones
to drop: pages: { calendar: false, category: false }. The
custom templates example turns them all off
and brings its own.
Pass options as the second argument to addPlugin.
eleventyConfig.addPlugin(blog, {
itemsPerPage: 20,
blogPostTemplate: "post.njk",
});| Option | Default | Description |
|---|---|---|
input |
Eleventy input directory | Folder that holds blog/ |
blogPaths |
<input>/blog/**/*.<ext> |
Globs for blog posts |
allPaths |
<input>/**/*.<ext> |
Globs for every page |
extensions |
All Eleventy formats | Template extensions to match |
itemsPerPage |
10 |
Posts on each index page |
blogSlug |
blog |
URL prefix for every index |
blogPostTemplate |
none | Layout applied to every post |
sortBlog |
newest first | Compare function for blog and blog_flat |
defaultCategory |
blog |
Category for posts without one |
pages |
true |
Built-in pages: true, false, or { tag: false, ... } |
layout |
a plain layout | Layout for the built-in pages |
feed |
none | { url, title, subtitle, author, limit, path }; url is required for a feed |
lang |
en |
lang attribute of the plain layout |
verbose |
false |
Log what the plugin collects |
Each index page carries its full URL in url, for example /blog/,
/blog/page-2, or /blog/tag/notes/. Build the permalink from it:
permalink: "{{ postslist.url }}{% if not postslist.url.endsWith('/') %}/{% endif %}index.html"<ul>
{%- for post in postslist.items -%}
<li>
{%- include 'tile.njk' -%}
</li>
{%- endfor -%}
</ul>Create paginated index of pages
| Field | Type | Description |
|---|---|---|
| pages | Iterable | Collection of 11ty pages |
| slug | String | Slug to be applied (see notes below) |
| prefix | String | Slug prefix |
| title | String | Given title |
| meta | Object | Undefined | Additional data to bound to each index page (see generateCalendar |
| itemsPerPage | Number | Number of 11ty pages on each index page |
Slugs will be generated as follows:
- First page
${slug} - Every next page
${slug}/page-${pageNumber}
| Field | Type | Description |
|---|---|---|
| title | String | Given title |
| slug | String | Generated slug (as described above) |
| pagenumber | Number | Number of given page (starting from 0) |
| url | String | Concatenated value from prefix and slug |
| total | Number | Number of pages |
| slugs | Slugs | |
| items | Page[] | 11typ pages on given page |
| ...meta | Anything that came from meta input |
| Field | Type | Description |
|---|---|---|
| all | String[] | List of all pages slugs |
| next | String | Null | Slug of the next page |
| previous | String | Null | Slug of the previous page |
| first | String | Null | Slug of the first page |
| last | String | Null | Slug of the last page |
---
title: Blog
pagination:
data: collections.blog
size: 1
alias: postslist
permalink: "{{ postslist.url }}{% if not postslist.url.endsWith('/') %}/{% endif %}index.html"
---
{%- include 'postslist.njk' -%}Generates a paginated blog. It runs paginate over the blog globs and can apply a layout.
| Field | Type | Description |
|---|---|---|
| blogPostTemplate | String | Undefined | Path to blog post template |
| blog | String[] | Globs for blog posts |
| itemsPerPage | Number | Custom number of items per page |
For a template example see paginate.
Generates calendar grouping by years and months.
| Field | Type | Description |
|---|---|---|
| blog | String[] | Globs for blog posts |
| itemsPerPage | Number | Custom number of items per page |
IndexPage objects generated here will be extended using meta field with
| Field | Type | Description |
|---|---|---|
| year | String | Year for annual group |
| month | String | Undefined | Month for monthly group |
| type | 'year' | 'month' | Type of group |
| shortTitle | String | Undefined | Formatted title for month groups |
See calendar.njk for a template.
TBD
TBD
TBD
TBD
TBD
TBD
Made by Lukasz Sielski. I build small products and help businesses run themselves. See what else I make at sielay.com.
Inspired by Jérôme Coupé