Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including grunt-writing with all npm packages installed. Try it out:

require("grunt/package.json"); // grunt is a peer dependency. var gruntWriting = require("grunt-writing")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

grunt-writing v0.0.3

Generate a simple collection of HTML posts from markdown, and an index of teasers.


Generate a simple collection of HTML posts from markdown, and an index of teasers.


Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-writing --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:


The "writing" task


In your project's Gruntfile, add a section named writing to the data object passed into grunt.initConfig().

  writing: {
    '<target>': {
      meta: {
        title: '<site_title>',
        description: '<site_description_(optional)>',
        author: '<site_author>',
        url: '<site_url>',
        lang: '<language_code_(optional)>'
      templates: '<directory_containing_jade_templates>',
      posts: '<directory_containing_markdown_posts>',
      dest: '<output_directory>'

Example Config

  writing: {
    build: {
      meta: {
        title: 'The Blog',
        description: 'IT\'s a blog',
        author: 'The Blogger',
        url: '',
        lang: 'en'
      templates: 'src/templates',
      posts: 'src/posts',
      dest: 'build'


All templates are expected to be written in jade. The templates folder must contain a minimum of 3 files: post.jade, index.jade & archive.jade. You're free to use whatever layouts / mixins you want, but you can't change the names of these files.

The post object is available to the post.jade template. The posts array is available to the index.jade and archive.jade templates. The meta object is available to all 3 templates (as well as your layouts).

RSS Feed

The rssURL property is added to the meta object for use in templating.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free