gypsydave5

The blog of David Wickes, software developer

Write and deploy a blog in less than thirty seconds

What’s the fastest way to start a blog? Wordpress? Jekyll?

Nah, it’s pandoc and now.

What’s pandoc?

Pandoc is a ‘universal document converter’ - a swiss army knife for changing document type a into document type b. It’s good for lots of things, but today it’s going to be good for turning Markdown (what we like writing in) into HTML (what we read on a website).

What’s now?

Now is a useful product from Zeit.com for deploying an application really quickly. It’s great for throwing up something to see how it works. It will serve up Docker images, NodeJS applications and static sites. Today, we use it for a static site. You can install it with a simple npm i -g now.

On your marks, get set…

So, make sure that you’ve got pandoc and now installed, that you’re in a nice clean directory and that you’ve got a connection to the Internet. And that you know what your favourite editor is. If you don’t have a favourite, pick the one you hate the least.

… GO!

Quickly - open a file called hello-world.md in your favourite editor and write something like this:

# Hello World

Hello world, this is the world's fastest blog!

Save it - faster, faster! And now run this in the terminal. What? I didn’t tell you to open a terminal session? Quickly, open one and run:

pandoc -o=index.html -to=html5 --standalone hello-world.md

IGNORE THE WARNINGS, we don’t have time to explain! Now… SHIP IT!

now

now will put your index.html on the Internet. It’ll even put the URL it uploaded it to in your clipboard. Now, open your least hated web browser and open the URL.

Success!

The other fifteen seconds is to bask in the glow of your achievement - you’ve earned it.

More?

What, you want more than one blog post in your blog? Are you crazy or greedy? Or both? Such luxury, millenials are so spoiled and entitled yadda yadda yadda…

Sure! Try this: open a new file called my-second-post.md and write your second post in it - I don’t care what you write about!

Now write index.md - like this:

# My Quick Blog

- [Hello World][hello-world.html]
- [My second post][my-second-post.html]

and now

pandoc -o=index.html --to=html5 --standalone index-world.md
pandoc -ohello-world.html --to=html5 --standalone hello-world.md
pandoc -omy-second-post.html --to=html5 --standalone my-second-post.md

finally, once again

now

Paste the new URL in your browser and…

BOOM! You now have a blog with an index page and two posts. Do a little dance!

Things you can now try out

Have fun