<em>A simple, bare-bones, file-based blog engine.</em>
A simple, bare-bones, file-based blog engine.
Derp is bascially a glorified markdown parser, and it wants posts in a certain way. Given the following
url: my-first-post# My First Post...herpin' the derp...
Derp will give you an object that looks like this:
title: "My First Post"url: "my-first-post"content: "<p>...herpin' the derp...</p>"
Derp takes the first heading 1 it finds and sets it to be the post's title. Anything before that heading is treated as a meta section. Simply add the
key:values you want, and they'll come out in the
url: a-new-posttags: derp, markdown, another tagdate: 15 June 2014# A new post...
title: "A new post"url: "a-new-post"tags: 'derp' 'markdown' 'another tag'date: "Sun Jun 15 2014 21:05:39 GMT+0100 (BST)"content: "<p>...</p>"
Derp treats certain meta keys in certain ways:
urlmeta becomes the url slug for the post, and is the only meta which is required. (Posts without URLs are ignored — think of it as a primitive draft system)
tagskey with a comma-delimmited list will become an array of tags
Other than those, add whatever meta you want!
Also, it'll watch for changes in the
post directory, making sure to keep everything updates for you.
npm install derpjs
Here's a basic (and contrived) example:
var express = ;var app = ;var derp = ;derp;app;app;app;
Parses all the posts, and sets up a watcher on the posts directory to keep track of file changes. Optionally pass in an options hash (checkout the defaults).
Returns a post that matches the given path (where the path is a relative url defined on a post).
Returns an array containing all the posts. The array is not sorted, so this is up to you.