Articles in the Blogging category

  1. I Switched My Blog From Blogofile to Pelican

    August 06, 2013

    This blog is a static website, which makes it fast, simple and secure. It was generated by Blogofile but I switched to Pelican.

    Blogofile has seen almost no updates over the years and I consider the project dead. Realising that blogofile is dead, I decided to look around for different open source static blog generators.

    There are many other static blog generators than pelican. But Pelican is well-documented, is based on Python, is very actively maintained (good track record) and supports all features that I wanted. Some of those features are Atom/RSS, Disqus and Google analytics support.

    My blog posts are written using Markdown. This makes it very easy to migrate away from Blogofile to Pelican, as Pelican also supports Markdown. Blogofile uses a different header format not recognised by Pelican, so you have to search and replace some key words in all your files before Pelican can actually generate your new website.

    I wrote this horrible bash shell for-loop to process all my blog posts:

        :::bash
        for x in *.md
        do
            TITLE=`grep -i "title:" "$x"`
            TITLEFIXED=`echo $TITLE | sed s/\"//g`
            DATE=`grep -i "date:" "$x"`
            DATEFIXED=`echo $DATE | sed "s/\//-/g" | cut -d ":" -f 1,2,3`
            CATEGORY=`grep -i "categories:" "$x"`
            CATEGORYFIXED=`echo $CATEGORY | sed s/\"//g | sed s/categories/category/g | cut -d "," -f 1 | /usr/local/bin/sed -e "s/\b\(.\)/\u\1/g"`
            echo "$TITLEFIXED" > tmp.txt
            echo "$CATEGORYFIXED" >> tmp.txt
            echo "$DATEFIXED" >> tmp.txt
            grep -v "title:" "$x" | grep -v -e '---' | grep -v -i "date:" | grep -v -i "categories:" >> tmp.txt
            mv tmp.txt "$x"
        done
    

    Notice how Build-in syntax highlighting of Pelican applies nice colors to this horrible code. Regarding this horrible code: I had to use GNU sed as the Mac OS X sed did not support the regular expression I used.

    To enable comments for my blog posts I always used Disqus with Blogofile. Pelican generates web pages in a different way compared to blogofile, so all old pages need to be redirected to the new location. I used the redirect functionality of Lighttpd to redirect all existing pages to the new location.

    The cool thing is that Disqus has a tool called "Redirect Crawler". If you have configured 301 "permanent redirects" for all pages and run this tool, Disqus will automatically update all existing links to the new locations, so your comments are migrated to the new web pages.

    Furthermore, I've implemented a Pelican plugin called titlecase which capitalizes the first letter of words in the title of your article. It's just that I think it looks better.

    I think I'm really happy with Pelican.

  2. 'Improved' Image Gallery for Blogofile

    January 21, 2011

    This blog is just static HTML pages that are generated using Blogofile. The Blogofile website sports a small image gallery that has been written to illustrate how to create your own 'controllers' or Blogofile plugins.

    My Python skills are horrible buy I managed to improve a bit on this example photo gallery. If you click on the 'Photos' menu at the top of this blog, you can see an example of the result.

    What is the improvement?

    • Basically one thing: it create a gallery by traversing recursively over a directory structure containing pictures.

    How to install?

    1. Just create a folder where you will store pictures.

    2. Add this to your _config.py

    photo_gallery = controllers.photo_gallery

    photo_gallery.enabled = True

    photo_gallery.path = "pictures"

    1. put this file into _controllers/photo_gallery
    2. enter into this gallery and create a symlink like:

    ln -s photo_gallery.py __init__.py

    1. download the example templates here.

    Additional info

    This photo gallery generator ignores symlinks. However, it looks for a special file name in every directory:

    showcase.jpg
    

    This file can be a symnlink to one of the photo's. It is used as the identifying picture for a folder with pictures. Every directory should contain at least a single showcase.jpg.

    If you have a folder called Europe containing two sub folders England and France, you can create a showcase.jpg symlink to one of the underlying showcase files of one of the folders. This picture will then be used to 'identify' the "Europe" folder.

    Example directory tree:

    ./Europe
    ./Europe/England
    ./Europe/England/London
    ./Europe/England/London/showcase.jpg
    ./Europe/England/showcase.jpg
    ./Europe/France
    ./Europe/France/Nice
    ./Europe/France/Nice/showcase.jpg
    ./Europe/France/showcase.jpg
    ./Europe/Netherlands
    ./Europe/Netherlands/Enkhuizen
    ./Europe/Netherlands/Enkhuizen/showcase.jpg
    ./Europe/Netherlands/showcase.jpg
    ./Europe/showcase.jpg
    ./USA
    ./USA/New York
    ./USA/New York/showcase.jpg
    ./USA/showcase.jpg
    
  3. Migration From Blogger to Blogofile and Disqus Is Complete

    January 04, 2011

    As stated in my previous post, I migrated all posts from blogger.com to my own host running blogofile. At the time of my previous post, I was not able to restore all comments made on my old blog. Thanks to some help from disqcus I fixed an error on my behalf and all old comments from my older blog appeared on the appropriate pages.

    This completes the transition from blogger to blogofile and discus (for comments).

    I'm now working on a controller for blogofile that recursively generates a static HTML photo blog. Relearning Python along the way. When working properly, the code will be made available so other people can at least have a good laugh.

    This blog is now running on an old Intel based Mac Mini, also acting as a firewall.

    mini

  4. Migrated This Blog From blogger.com to Blogofile

    December 30, 2010

    Until now, I was hosting my blog on Google's blogger. I switched to using Blogofile. I wanted to have more control over my content and the layout.

    I had many issues with the blogger blog post editor, resulting in ugly posts with too much white space, strange fonts and fonts sizes. Also, showing programming code examples with syntax highlighting is not possible with Blogger. As a nerd, I'm a control freak and I was not in control enough over my blog on blogger.

    So I first started thinking about hosting my own wordpress site, but soon I concluded that this is not what I want. Wordpress has similar limitations as blogger and I no longer want to be depending on some special blog software without direct access to my content. So after a tip of a friend of mine I started to look at blogofile. Blogofile generates a static HTML website, which is a real benefit if you are hosting your own site. The most important benefits are:

    • Security
    • Performance
    • Ownership

    Security

    Most websites get hacked because they are basically live applications accessible from the Internet. Applications can contain bugs. If it contains security related bugs, you are toast. Software like wordpress has an awful track record regarding security. Basically, if you are running a wordpress site, you must be in a state of constant fear. You also constantly have to upgrade to the latest version within a short time frame or you will be hacked. I think that wordpress is a security hazard.

    Blogofile generates plain text static HTML web pages. There is no dynamic content and thus no program running, except for the web server itself. There is no serious security risk.

    Performance

    Plain text web sites are fast. It is just data. When a visitor requests some web pages, there is no application running, laying pressure on the CPU, just plain data transfers. I bet you could host this blog without much performance problems on a recent smart phone like an Android or iOS device.

    Ownership

    All content is stored in a text-only format that can always easily be transformed into some other format. I use markdown syntax to write new blog posts. But plain HTML can also be used. Comments can be posted through discus. It seems however that I will loose all existing comments of my original blog. New comments are showing up without a hitch, but existing imported comments do not show up. I do want to preserve them but how? I'm not sure yet. I'm thinking about incorporating them in my posts as an appendix.

    The whole process of migrating to blogofile

    All steps taken so far as to migrate away from blogger:

    1. Create a wordpress installation
    2. Export blogger blog.
    3. Import blogger blog in wordpress installation
    4. 'Import' the converted wordpress blog to blogofile 'format' using wordpress2blogofile.py
    5. Hack, script and fight to change all URLs so they are correct for the new site.
    6. hack, script and kill to get the old comments to show up, to no avail.
    7. Learn markdown
    8. Learn blogofile
    9. Create + steal a new website design and have to learn css and html all over again.
    10. Convert all posts from html to markdown.
    11. Fix all converted posts where necessary
    12. Put all external hosted content into a local folder and fix all links.

Page 1 / 1