Blog posts in Markdown with Frontmatter for Roots
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Roots Posts

Roots Posts adds blogging with Markdown and Frontmatter to Roots.


  • make sure you're in your roots project directory

  • npm install roots-posts --save

  • modify your file to include the extension

    posts = require 'roots-posts'
    module.exports =
      extensions: [posts(folder: 'posts', layout: 'post')]


Once you've configured the extension, Roots will search the specified folder for blog posts.

Each file in that folder should be a Markdown file with a name following the pattern:


Each post will be rendered with the specified layout (in this case views/post.jade) and from the layout you can access a post variable with the title, date, body, and other metadata from the post.

extends layout

block content post.title
  .post-body!= post.body

Post Listings

You can also list posts in any of your templates by using one of two build-in helper methods:

  • posts.byTitle() lists posts alphabetically by title
  • posts.byDate() lists posts by date in reverse chronological order

The name of the collection is based on the folder. So if you configure the extension with posts(folder: 'posts') you will be able to use posts.byDate() in templates. If you configure the extension with posts(folder: 'docs'), you'll use docs.byDate() in templates.

  each post in posts.byDate()
    h3.title post.title
    .body!= post.body


This extension is published under the MIT License