A quick and easy way to host your own code blog.
Simply create your-blog-post.md
files in the /posts
directory and you're done. GitHub flavoured markdown is supported and code blocks are automatically highlighted.
The first three lines of any post should look like the following:
tags: tag1 tag2 tag3
title: Blog Post Title
preview: A quick introduction of what the post is about.
date: Jan 1 2013
---
The markdown body of the post should follow the ---
line.
To highlight a block of code, surround the code with three backticks and a language specifier:
```javascript console.log('Hello World'); ```
To force the code block to have no highlighting, use the language specifier no-highlight
.
Before deploying your own copy, please change the options in the config.js file:
module.exports = {
email: 'hello@martinrue.com', // used to generate the blog image
title: 'Blog Title Here', // the page title and the blog header text
style: 'monokai' // the syntax highlighting theme to use
};
You can set the style
config to any of the following values: arta
ascetic
brown_paper
dark
default
far
github
googlecode
idea
ir_black
magula
monokai
pojoaque
rainbow
school_book
solarized_dark
solarized_light
sunburst
tomorrow-night-blue
tomorrow-night-bright
tomorrow-night-eighties
tomorrow-night
tomorrow
vs
xcode
zenburn
.
Simply clone the repo, install dependencies and run node codeblog.js
:
git clone git@github.com:martinrue/codeblog.git
cd codeblog
npm install
node codeblog.js
Now hit http://localhost:9111
and you should be running your own code blog.
If you want a more permanent home, deploying to heroku is super easy. Make sure you have an account and you have installed the heroku toolbelt, then:
git clone git@github.com:martinrue/codeblog.git
cd codeblog
heroku create
git push heroku master
heroku open