Welcome to this new blog!
It's a great pleasure to welcome you to our new blog. I have always been willing to host our blog but the time was missing to integrate or review the easiest way to do it without requiring to invest too much effort. It turns out I have chosen to write a custom made blog engine. And so, I thought it could be a great opportunity for an article on the subject.
I wanted to have the blog integrated in the site without any redirection. And since I use expressjs for most of my own web services, I needed to be able to easily add it to an existing express app.
I went shopping on the npm registry and on github, there were many blog engine alternatives but none of them seemed to fit my expectations. I wanted something extra simple, something dumb. The blog engines I found were too smart for me.
A blog concept
I found that the problem was I never really expressed my needs. What is a blog for me? Ok, this is how I would dream my blogging activities:
- Write markdown articles in a text editor on my pc
- FTP the markdown file to my blog hosting machine
- View blog articles on the blog web site url
And on the server side, maybe something like this:
- add the blog engine as a route callback:
var app = express(); ... var blog = require('./blog.js') app.get('/blog', blog);
Most of the time when you write a text, all you need is the text. But when you write a blog there are few information that need to be shown like:
- the author's name
- the date at which the article was written
- the subject
- the associated tags etc...
You may think of more or less information but the point is that this kind of thing should be tied as much as possible to the article itself. Ideally it should be processed automatically but this may require a lot of code and work. So, the easiest solution is to add these meta information in the blog article. And it turns out that most of the blog engines do that. They add the formatted meta data at the beginning of the text in either yaml or json format.
This is exactly what we will do. But I opted for the way mails are formatted like so:
from: orion subject: My First blog post! tags: foo, bar, baz # Hello world! Notice the blank line separating the meta header part and the content part
See you in part 2 :)