brunch-blog v3.0.0
Brunch Blog Plugin
npm install brunch-blog --save-dev
You may be saying to yourself... OMG, why another static blog utility?
Brunch didn't seem to have one, and I like brunch.
Features
markdown => static HTML under
./public/blog
tags => static HTML under
./public/tags
Disqus => simply add your Disqus shortname to
config.plugins.blog.site
Twitter => add your username to
config.plugins.blog.twitter
RSS => generates an RSS feed at
./public/rss.xml
metadata => Posts can be written with metadata that you can integrate with your own custom templates
drafts => drafts work by adding
draft: true
to a post's metadata headersyntax highlighting => done at compile time with the awesome
highlight.js
moment.js helper => moment.js helpers are included in the template layer, so you can easily work with dates
pagination => WIP
This plugin is for generating a static blog quickly and seamlessly with your regular Brunch workflow.
It comes with a few sensible defaults, and will install the necessary - pug templates to quickly prototype a blog
By default posts live in the ./blog
directory and not ./app/blog
Templates also live in ./templates
and not ./app/templates
because templates in your app directory are assumed to be SPA templates (ala Dust.js or what have ye) and not for static assets.
Writing a blog post
Writing a blog post is generally simple and utilizes an optional YAML metadata header
---
tile: some post
draft: true
publishDate: 2016-07-15
tags: awesomesauce, awesomepossum, epic
---
Some amazingly well written content here!
all key values in the metadata header section are passed into your pug
templates on render and require no special work from you.
Custom helpers
Since brunch uses a brunch-config.js
file, you can add helpers by simply requiring them and adding them to the site
key
Config
Brunch_Blog.defaults = {
// input folder where your Markdown files live.
inDir : "blog"
// the public folder where the blog lives at
, outDir : "blog"
// the folder in the app root where templates live
, templatesDir : "templates"
// things you want to configure for compile time
, site : {
title : "Blog'o'Brunch"
// used for permalink generation
, url : "https://www.example.com"
, disqus : null
, twitter : null
, github : null
// RSS options from the `rss` module
, rss : {
generator : "Brunch"
, length : 20
}
}
}