Github pages are great for a static website. But you can't really use them to power your blog. BlogDown is a NodeJS server that uses a github repo to render a blog. Your posts are markdown files within a posts/
directory. That simple.
By using github for storing the posts, it's very easy to manage who can write and edit them. That makes it great to use for your company engineering blog for example since all your engineers already have access to your repos. You don't need to create a Wordpress or Tumblr or whatever and deal with access rights.
It's also great for a personal website. Especially if you write technical posts or if your friends are on github and you want to make it easy for them to collaborate with you on your next blog post.
It's a simple NodeJS server. There is no database. All the content is in a separate content repo.
-
Clone the repo
git clone git@github.com:xdamman/blogdown.git
-
Run
npm install
-
Start the web server by running
npm start
Then open your browser to http://localhost:3000
and follow the instructions on the screen. You will have to make sure that your server has a public IP (or domain) so that Github can send a webhook to it.
- Posts are markdown files (can be hosted in a github repository)
- Fully responsive using Bootsrap v3
- Minimalistic design focused on content consumption
- Automatically reflects the latest changes in your content thanks to webhooks
- xdamman.com
- (please add your site here if you use this node server)
The content of the site lives in a separate repository. This is by design for two reasons:
- You can make the content repo public and allow anyone to submit pull requests to edit the content without having to worry about the code of the server.
- You can create new content or edit it without having to redeploy the server (you need to configure a github webhook to notify the server when there is an update in the content repo. The POST route is
/webhooks/github
).
This repo should contain 3 directories:
/posts
: where your posts are (they need to have a.md
extension (for markdown))/partials
: partial content that can be used in the views. For now, there is only aabout.md
that we render at the top of the homepage and at the bottom of every post./public
: public directory where you can store any static asset. They will be available fromhttp://localhost:3000/public
To run on production, you will need to run it as sudo
to bind it to the port 80. Otherwise you can keep it on any other custom port and put Varnish or Nginx in front (I'm personally running it directly on port 80 and I use cloudflare for caching at the CDN level.
sudo NODE_ENV=production NODE_PORT=80 node server.js
You can copy the blogdown.upstart.conf
script at the root of this repo to /etc/init/blogdown.conf
. Just modify the path to where your blogdown installation is. Then you are good to go. You can start/stop the service using sudo start blogdown
.