A word of introduction before we go to 'tutorial' part. If you want to go to the tutorial part right-away - please use Making Blog using Pelican


I've been struggling on how to begin my own blog (which post will be best) and then found out, that I'm thinking about re-creating blog-engine or using existing.

So after starting to inspect what type of engine's for blogs there are - I've got my "lightbulb" - Why not use this as a post ?

I've even see this as type of "inception" - to post about posting blog :) .

And so we begin our adventure.

Types of Blog-Engines and Questions to Blog-Readers.

There are two types of blog-engines - dynamically generated and static-html-generators

Based on what purpose and your preference, you pick one of those.

You have to ask your-self few questions to know which type of engine and blog-type you'll need.

  1. Do you want to write your blog (almost) without using internet ?

    If you want to create your posts for blog at your "spare" time and when you have time upload them to server, then definitely you should pick the static-html-generators type.

    After writing article for blog using ".rst" (reStructured) or ".md" (Markdown) file, you will generate html files and push them to server.

  2. Do you have finance for keeping server that uses some programming language (i.e. c#, java, php, python) ?

    Depending on what type of language you pick, you may find yourself in a problem of too-expensive server for your usage, or you may have to use your own ISP provider with your hardware at your home. (VPS is also an option)

  3. Do you have time for maintaining own blog-engine ?

    Did you know, that the most popular blog-engine called "wordpress" has it's own vulnerability page with different types of vulnerabilities ? It means that as soon as a patch for those vulnerabilities is available, you OUGHT TO upgrade your wordpress to this "patched" version ? If you still going to use WP than please have a few minutes and get familiar with THIS LINK

  4. Do you like Markdown/reStructured/ASCIDoc/etc?

    Both static-html-generators and dynamically generated can be used for writing your posts in those languages for plain-text-formatting.

  5. Why not to try static-generator for blog-posts ?

    I admit - this blog is created using only VIM, bash terminal and Pelican python static-html-generator. I've given a try and for now it's working for me. Maybe after-while I'll change my decision ? But right-now I'm happy with how this system works. It needs some tweaks here and there, but it's more cheap-maintainable and easy-to-use then other I've used before.

    But as usual - that's only my opinion - yours may vary depending on preferences.

Why Pelican ?

In case of python static-site generators, there are only few of them, that you may use. I've found Pelican best fitting my needs. Below are Dis-Advantages for Pelican:

Advantages of Pelican:

  • Great amount of themes that you can shuffle.

  • Great amount of plugins

  • Python expansibility.

  • Using both Markdown, reStructured files for writing content.

  • Quick-Starter script that helps creating initial setup for your blog.

  • Using Fabric for deployment.

  • Add Disqus to your Posts is super-easy - just add "DISQUS_SITENAME" and set at administration of DISQUS website on which you'll use DISQUS and off-you-go :)

Disadvantages of Pelican:

  • Some themes may be complicated and not explained enough for a "quick" shuffle - you may occur some errors upon changing theme.

  • Some Extensions need to be also set at pelicanconf instead of theme-config.

Making Blog using Pelican

1. Installation of python package:
pip install pelican
pip install markdown # Only if you intent to use Markdown
2. Setup pelican using quick-start script build-in with pelican:
  • You'll answer questions and get a standard setup with name of blog and setup for publishing. If needed help, check at : Kickstart-Your-Site
3. Go to directory you setup in quick-start guide. Go to directory "content" and place a file like "my_first_post.md" with following:
Title: MyFirst Post Title
Date: 2017-03-01 17:30:30
Tags: initial, pelican

This is information that will be visible as content of this "myfirstpost" page.
4. Go back to pelican directory and :
make devserver

Which will use created pages in content directory and startup a development-type page at your localhost with port 8000 page

Using Themes

To make use of themes with Pelican you need to:

1. Clone pelican-themes repository : git clone --recursive https://github.com/getpelican/pelican-themes /data/pelican-themes

2. Clone pelican-plugins repository : git clone --recursive https://github.com/getpelican/pelican-plugins /data/pelican-plugins

3. Setup theme with it's description that should be in "README.md" or other similar file.

How to use this blog's theme ?

In this particular blog I've used pelican-bootstrap3 theme. I've picked this theme, because it supports responsiveness to changing window size(you can resize your window and content will not be cut-out in some strange way).

To setup this Theme I had to make few steps (necessary):

1. Clone thems & plugins ( as presented in #1 & #2 )
2. Add to pelicanconf.py :
PLUGIN_PATHS = ['/data/pelican-plugins']
PLUGINS = ['i18n_subsites']

THEME = "/data/pelican-themes/pelican-bootstrap3"
    "extensions": ['jinja2.ext.i18n'],
3. Re-build blog using:
make html

Where is my content generated ??

It's at the OUTPUT_PATH which may be setup at pelicanconf.py if you set different output directory than default - meaning output/.

All Settings description can be found at settings

Thanks :)

That's all. Let me know in comments below what do you think about this blogging solution?

Do you think static-generated sites using a Pelican or other engine is your thing ?


[1] PyDanny's Choosing Blog Post.

[2] Reddit's post about blogging software comparison

[3] Python Blogging Software at python.org

[4] Pelican's Documentation Page.

[5] Pelican's Themes.

[6] Github Pelican Source-Code

[7] Nafiulis more-comprehensive post about making blog using Pelican.

[8] Markdown Cheat-Sheet at Github

What's next ?

Well ... you don't know what future may give you. I hope to solve few problems I've found while writing this post and creating my first blog using Pelican:

1. A code-box that can be copy-pasted using one-click of button (maybe some plugin? )
2. Theme I've used does not support natively my native language, so I'm planning to extend this theme and maybe fork it within github.
3. New post in next Wednesday :) Stay Tuned :)


comments powered by Disqus