Thu, Sep 15, 2011

: A New Blogging System

I started blogging back in the dark ages before it was even known as blogging. Back then (in 1999) all I knew was that I had a website and wasn’t updating it. I wanted to have something regularly to write about, so I came up with the idea to write about movies I watch and books I read. Back then there really didn’t exist much in the way of “blogging” software (seeing as blogging didn’t really exist) and the web publishing systems that did exist were expensive and complicated.

So I did what I usually do in those situations: I wrote my program to do my blog. The program’s incredibly ugly see the picture, but it’s worked fairly well for me for over ten years. I have updated and changed it considerably over that time, but the basic premise stayed the same: the program simply keeps a list of entries and generates the appropriate .html files for the site.

There are a number of disadvantages to that type of system. The most obvious is that every time I add an entry, the entire site must be regenerated. Of course my program is smart about that — it only saves the changed pages. But internally it must generate the entire site: there’s no other way for it work. That means that the more entries I have, the slower the site generation process becomes. That’s not a huge deal with today’s computers — even with ten years worth of entries my entire site still only takes seconds to generate. But the process feels slow. (Just the fact that I have to use a special program to write in feels slow.)

While I like the full control my blogging software gives me, an even bigger disadvantage is that I’m limited in how I can publish. For instance, modern blogging solutions will let me blog with an app my phone or any web browser. I often delay blogging currently not because I haven’t written the post but because it’s a hassle to publish it.

Most modern blogging systems are all dynamic. That is, they create the site as people visit the blog. The advantage of this is that you can easily make site-wide changes instantly. But to do that, the blogging system must be software running on your web server. They usually use a database. This raises all sorts of complications, from installation and configuration hassles, security implications, speed and reliability, and more. While I wanted the benefits of a dynamic site, I wasn’t excited about the process of getting there.

I’ve been thinking about switching to a “real” blogging solution for many years now. I even tried to use blogger.com a few years ago, but I found the process cumbersome. A bigger issue was that I couldn’t find a way to import my previous ten years of blogging. I didn’t want to start over: I wanted to migrate.

Recently I’ve been looking at various systems. Some, like Squarespace, seem impressive, but they are expensive ($8/month and up). I’m already paying for a web host: why do I need to pay another monthly fee for a blogging system? (And I’d have to pay it again for each blog I set up. Yikes!)

I looked at other systems and they range from free to inexpensive, but most require a database running on your website and are complicated to learn, run, and maintain. I know zip about databases and I’ve heard horror stories of them becoming corrupted and people losing decades worth of blogging entries. I didn’t want that. Besides, every time I looked into those systems, it felt like I needed a year of school just to understand how to install the blasted thing, let alone configure it and use it. (The documentation for open source software is usually horrendous.) I mostly don’t like the way the systems make me feel like an idiot. They assume so much knowledge on my part it’s frustrating. (I really hate web development with a passion hotter than Chernobyl.) I end up not wanting to even learn the tech. The tech also changes so rapidly — if you’re out of it even for a few months it’s all new. Everyone’s switched to a new hot language or new standard and you have to start over!

Introducing Blosxom

A few days ago I discovered a mention on my webhost’s site about a blogging system called Blosxom. I started reading about it and immediately got interested. The key thing about Blosxom is that it doesn’t use a database: it uses ordinary text files. Each entry’s a separate file and you store them in folders by topic. The files themselves are awesomely simple: the first line’s the title of the post. Everything after that is the text of the entry. That’s it!

I love simplicity and Blosxom sounded like just the thing for me. I was still a bit baffled about how to install and use it — those IT support documents sure make everything sound complicated — but in the end it’s really fairly simple. (I did run into some more complex things later, but getting it up and running was just minutes.)

Blosxom is written in Perl. It’s just one long Perl script. I don’t know Perl and the code looks like gibberish, but it works great. You just install the file on your web server. (My host gave me instructions on how to use SSH and install the file using the command line. That took some figuring out and I got it to work, though I’m not sure that was strictly necessary as I’ve been able to edit the file via FTP since then so I don’t know why I couldn’t have used FTP to begin with.)

There are a handful of settings inside the script you need to modify to customize Blosxom for your site. It’s not difficult — they’re just variables like the name of your site, the URL to your site, etc. — but it probably would be easier if the settings file was a separate document. Right now you edit the actual blosxom.cgi script, which can be a little intimidating.

The most important setting — really the only critical one — is to tell the script where to find your blog files. You just specify the file path to your folder of your posts. (This is on your website, not your local machine.) Once you do that, you can make a simple test post file and go to your website to test it out. You just add blosxom.cgi to the URL of your site, like this: http://www.zeedar.com/blosxom.cgi.

After a few minutes of playing, I started to think Blosxom was pretty cool. There was still the big question of migrating all my old data, but since I wrote that program myself, that didn’t seem difficult. And I loved that my new blog format would be plain text files so it’s not like I’d be converting to some obtuse, proprietary format.

I think it took me an hour or so to get my conversion program perfect. Getting the basic conversion working wasn’t long, but there were tricky things, like making sure I converted any self-links referred to in my posts to the new system. There were also some unrelated delays and I had to figure out other aspects of the posting format. For instance, Blosxom gets the date-time of a blog post from the date-time stamp of the file. That meant my exporter had to modify the date-time stamp of each file (not difficult, but an extra step I had to realize was needed).

Since then I’ve been tweaking the site, installing Blosxom plugins, and learning. The saddest thing I’ve found is that Blosxom isn’t much supported any more. It seems like many of the developers have moved on to other things. A lot of the plugin sites have disappeared, too. But that’s also a sign of a mature product: basically Blosxom is a simple tool that works and there isn’t a big need for improvement.

Sweet Markdown

I was most pleased, however, to find that one of my favorite concepts — a plain text file format called Markdown — works with Blosxom! The idea behind Markdown is brilliant: it’s a plain text formatting system that doesn’t look like any kind of mark-up at all.

For example, in my most of work I use XML. I like XML because it’s plain text, but the tags aren’t exactly unobtrusive. Here’s an excerpt from an article I’m writing for RSD:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Feature>
<MainHeadline>Fun With Comics</MainHeadline>
<SecondaryHeadline>How Marc solved a
comic problem</SecondaryHeadline>
<Byline>by Marc Zeedar
editor@rbdeveloper.com</Byline>

<Article><ArticleFirstPara>My favorite
use for Real Studio is solving day-to-day
problems. With Real Studio I feel like I
myself can live up to Apple's iPhone
slogan, "There's an app for that" by
writing whatever I need!</ArticleFirstPara>

That looks complicated, right? It’s not — the tags are simple and fairly obvious — but it’s definitely not the easiest thing in the world to look at when you’d rather concentrate on writing. With Markdown, your text actually looks very similar to how it ends up on the web.

In Markdown, lists look like this:

- item 1
- item 2
- item 3

That prints out like this:

  • item 1
  • item 2
  • item 3

And italic and bold words are formatted in a way that’s easy to do and looks like the final rendering.

And _italic_ and **bold** words are formatted in a way
that's easy to do and looks like the final rendering.

Even ugly things like web references are elegantly handled:

Here's an excerpt from an article I'm writing for [RSD](http://www.rsdeveloper.com):

And I can quote text simply by prefacing each line with > just like quoted email:

> I never travel without my diary.
> One should always have something
> sensational to read in the train.
> -- Oscar Wilde

appears like this:

I never travel without my diary. One should always have something sensational to read in the train. — Oscar Wilde

(By the way if you’re wondering how I created the above non-rendered versions, Markdown makes that super easy: just indent the lines and Markdown treats everything as code. That means HTML tags are converted to entities so they show up as text, not HTML. Pretty sweet!)

I haven’t used Markdown much though I love the concept (for years I’ve used a similar plain text approach for my fiction writing — it would be trivial for me to convert most of that to Markdown), mainly because I didn’t have a way to run the Markdown plugin. (Technically that’s not true: I could have run it, I just didn’t know that and didn’t have it as part of my workflow and I hadn’t added in support to my Z-Web Maker blogging tool.) Anyway, in learning about Blosxom I learned that Markdown is a Perl script, too, and it’s simple to drop it into the Blosxom plugins folder and bingo, every post you make is automatically converted from Markdown to HTML on-the-fly as Blosxom renders your site! (I also installed John Gruber’s Smartypants plugin as well. It converts all my posts’ punctuation to smart typography.)

So now I can format all my posts using Markdown. My old posts, which used HTML tags, don’t need to change because Markdown allows you to mix in HTML whenever you need it. (For instance, I could use regular HTML tags for <i>italic</i> if I wanted and Markdown wouldn’t care.) But Markdown makes so many things, like web references, quoting text, and more, so much easier, and it looks far more appealing on-screen, that I’ll use that more and more.

A New Workflow Now that I’ve got the new site up and running, the question is how do I work with the new site? That’s the beauty of this new system. Since posts are simply text files on my website, I can create/edit them with any editor and FTP them to my site and they instantly appear.

Right now I’m writing and editing this post live on the web. Well, nearly so. Basically I’m editing this post on my FTP site using BBEdit. Every time I hit “Save” the file is saved on the FTP site, so if you come visit zeedar.com while I’m doing that, you’ll see the change immediately. It’s awesome for me, because as I’m learning, I can preview it immediately on the site. (Which is why, if you’re reading this as I write it, you’ll see a lot of experimental garbage as I test things. That stuff won’t appear in the final version of this post.)

I bought a program called Textastic for my iPad and it really is fantastic. It lets me edit color-coded HTML, XML, Markdown, and other text formats and I can bring in my text from Dropbox or an FTP site. That means I can do similar editing to BBEdit right on my iPad!

Being able to blog on the fly like that is huge, but I also wanted the ability to blog by email. Blosxom doesn’t support anything like that, but that’s not a problem. I just wrote my own program to do it! It’s fairly simple: it simply runs in the background and checks a special email account I set up. When it finds a new email, it downloads it. Then it saves the whole thing as a text file in the correct folder and it posts it to my FTP site. It was a little tricky getting everything to work and it’s not flawless yet, but it works pretty well. Several of the recent posts I’ve made here I did via email — not that you’d notice any difference!

I even made my program support images, so if my email message contains pictures, those automatically get posted as well! Now, in theory, I can be somewhere, take a picture with my iPhone, and blog about it instantly. And I’m doing this for free, with standard lo-fi tech. I love it.

The bottom line is this will make my blogging much easier, faster, and better.

What does this mean for you?

Currently, not much. Hopefully the site will still work and there’ll be no immediate changes from a reader’s perspective. But in the long-term, this should make me more enthusiastic about blogging, so posts will be more frequent and reliable. I also see this as just the beginning. I’ve already made some enhancements to the site (for instance, I’ve hidden the links and archives on my sidebar by default which makes things look less cluttered) and I hope to do more. (I’d like to do a completely different design, but for now this one works.)

For me, since this is my low-traffic personal site, this is where I experiment and learn, so I’m hoping to leverage my new Blosxom knowledge and create several more blogs for my various websites. Some of them will be more complicated than Z-Web (though I won’t have to worry about them being backwards compatible with the old site).

Topic: [/zweb]

Link