Section plugin that sets up paths for html files.


This is a plugin for Section, a static site generator, that builds paths and URLs while also extracting dates and indexes from filenames.

This plugin requires the ~0.1.0 version of the grunt-section plugin.

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. You may install this plugin with this command:

npm install section-router --save

This plugin introduces a number of new options that can be set on the grunt-section configuration object inside the Gruntfile.js file. Here’s a simple example of how that file might look like:

  section: {
    target: {
      options: {
        contentExtensions: ['md', 'markdown'],
        baseURL: '',
        dateRegex: '^\d{4}-\d\d-\d\d-',
        indexRegex: '^\d+-'
      src: 'input/directory/',
      dest: 'output/directory/'

type: Array default: []

An array of extensions dictating what files should be treated as content files. Content files are text files that have their bodies loaded into memory for transformation purposes and are later written to disk as html files.

type: String default: ''

Usually this is the root of your website, and will be used to determine the URL of each page/resource.

type: String, default: '^\d{4}-\d\d-\d\d-'

By default, for a file named something like the plugin extracts the date and removes it from the filename.

type: String default: ^\d+-

The index of a file determines its position in listings such as menus. By default the plugin looks for files like In this specific case the file will have the 01- removed and will take the first position in listings.

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Initial version