Results tagged “blogging”

Drupal to Movable Type

Now, I’ve done it. I’ve relaunched my blog using a design I’ve been building on for a few months. (I don’t have much time for such things, so it takes some time to build anything out for this site.) Anyway, there’s more bits and bobbles to tweak out, but the basics are now there. It’s quite an update since I haven’t really dinked with either the overall design or platform running my web site for a few years. The big technical change has been that I am now using Movable Type rather than Drupal to serve my blogs. I’m going to start by explaining why and then I’ll delve into how I made the move.

Why Movable Type?

The main reason for the switch from Drupal to Movable Type is because I wanted to try something new. I’ve been on Drupal for a long time and am familiar with it. I’m also likely to maintain that familiarity for quite sometime since we use Drupal extensively at work. To paraphrase The Matrix Revolutions, “You do not truly know an application until you fight it.” In this case, I’m running Movable Type and getting a feel and we’ll see how long it lasts. In the past, I’ve had similar short runs of Blosxom, WordPress, and a few experiments in creating my very own brand of blogging software for kicks and giggles. Drupal has outlasted them all. If I decided I don’t like this experiment, I may go back.

Movable Type is written primarily in Perl. I like Perl and think it beats the pants off of PHP as far as languages go. Drupal is written in PHP. I have written some plugins for Drupal in PHP, but I’d rather be writing Perl. So, if I’m going to dink around with something at home for fun, I figure it ought to be in something I enjoy.

By using Movable Type, I have been able to vastly improve the performance of my blogs. I host on Dreamhost, which is great for the price, but performance is an issue from time to time since it is a shared hosting solution. Movable Type publishes most of my pages as static HTML (the ultimate page caching system!) and then updates them as needed when new posts or comments are added. My web site is much zippier now since it doesn’t have to what for PHP (or even Perl CGI/FastCGI) to load for every page.

Movable Type does blogging with a lot of subtlety and nuance. If you look at how everything works, there are a lot of teeny details that it does just right. Drupal does general content management pretty well, but blogging is done just alright. For example, Movable Type provides Atom and RSS feeds out of the box, Drupal provides just RSS unless you add a module on. Movable Type provides RDF and other summaries as part of every post to make it easier for bots to understand my site. The widgets (similar to Drupal’s blocks) are geared towards blogging and seem to make more sense overall. It’s a tool tailored to the specific job rather than a tool tailored to a larger job. I’m not at all knocking Drupal. But even a really great Swiss Army knife isn’t the best screwdriver, it just has a pretty decent one available.

Those are the main reasons for moving to Movable Type. Now, on to how to do it.

Migration from Drupal to Movable Type

Most of the information I was able to find on moving away from one platform to another was, unsurprisingly, Movable Type to Drupal. I found some folks looking or information on going the other way, but nothing definite. I’m going to explain the process I used in hopes that someone else might find it useful if they decide to make a similar move.

Database Conversion

The first and most complicated problem is moving the data. Movable Type helped to simplify this process by providing a standardized import tool. If you go into the back-end MT interface and look on the home page, there’s a link in the right sidebar labeled “Import Content”. If you follow that you can see a form that lets you import data in Movable Type import format or WordPress Import Format. Since I couldn’t find any information on the WordPress format and since I didn’t use WordPress, I left that alone.

The documentation for the Movable Type format is readily available here. That’s not actually the whole story, though. I discovered, by experimenting with the data export function, that there are some additional fields, such as “TAGS,” which allow you to import tags and such as well. Getting the Drupal data out was relatively easy since this is a very simple text format.

I have a little trick I do whenever I need to perform a one-time script on a Drupal instance. The trick is that I write a PHP script that does whatever I need, go into Drupal to create a new page, paste the code into that page, and then switch the input format to PHP. Then, instead of creating the page, I click “Preview,” which executes the script and does whatever I want. I wrote such a script for this occasion.

Here it is:

<?php
header('Content-type: text/plain');
$nids = db_query("select distinct n.nid from {node} n inner join {term_node} t on t.nid = n.nid where t.tid = 360 or t.tid = 362");
while ($node = node_load(db_fetch_object($nids))) {
  print "AUTHOR: ".($node->name=="Andrew Sterling Hanenkamp"?"zostay":$node->name)."\n";
  print "TITLE: ".$node->title."\n";
  print "STATUS: ".($node->status?"Publish":"Draft")."\n";
  print "ALLOW COMMENTS: ".($node->comment>0)."\n";
  print "CONVERT BREAKS: 1\n";
  print "ALLOW PINGS: ".($node->comment>0)."\n";
  print "DATE: ".strftime("%m/%d/%Y %I:%M:%S %p", $node->created)."\n";
  $tag = array();
  foreach ($node->category as $category) {
    $tag[] = $category->title;
  }
  print "TAGS: ".implode(",", $tag)."\n";
  print "-----\n";
  print "BODY:\n";
  print $node->body."\n";
  print "-----\n";
  print "KEYWORDS:\n";
  print "/node/".$node->nid.",".url('node/'.$node->nid)."\n";
  $comments = db_query("select * from {comments} c where c.nid = %d", $node->nid);
  while ($comment = db_fetch_object($comments)) {
    print "-----\n";
    print "COMMENT:\n";
    print "AUTHOR: ".$comment->name."\n";
    print "EMAIL: ".$comment->mail."\n";
    print "IP: ".$comment->hostname."\n";
    print "URL: ".$comment->homepage."\n";
    print "DATE: ".strftime("%m/%d/%Y %I:%M:%S %p", $comment->timestamp)."\n";
    print "SUBJECT: ".$comment->subject."\n";
    print $comment->comment."\n";
  }
  print "--------\n";
}
exit;
?>

This script takes all the nodes belonging to the categories with IDs 360 or 362 and outputs the files in the Movable Type export format. If you change the first query to use a different set of terms or remove them you can export everything or some different subset. I did this because I had 4 web sites served from one Drupal database and the terms determined which site they appeared on. I then condensed two sites together, which is which site this is.

The export script applies all terms as the tags. The script could be customized to narrow that down for your site, if needed.

The script had two basic flaws, which I fixed after the export and reimport (rather than doing everything over again). First, the “SUBJECT:” line from the comments didn’t look as good as I wanted. I’d recommend changing that to “Subject:” or removing it all together. I used the Search and Replace feature of Movable Type to correct it. The script also added “————” at the end of some of the comments, which I also removed using Search and Replace.

The other nice thing I did here (at least for me) is that I added the main “node/123” URL and also the main URL alias to the keywords. Which I take advantage of next.

Fixing up the URLs

Drupal provides URLs as just the identifier into the node table, like “node/123”. I had used some modules (i.e., “pathauto” and “URL Alias”) to provide nicer URLs that looked like “2008/03/30/drupal-to-movable-type”. Movable Type provides URLs as “2008/03/drupaltomovable_type”. This works well to allow me to provide some redirects to the new URLs. To do this, I’ve imported the URLs as keywords (as mentioned above) and then added the following lines to my .htaccess files in my new blog sites:

RewriteEngine on
RewriteRule ^(node/\d+)       /mt/mt-search.cgi?search=$1 [R,L]
RewriteRule ^(\d+/\d+/\d+/.*) /mt/mt-search.cgi?search=$1 [R,L]

Now, whenever someone hits one of the old links, they are redirected to a search, which will find the post they were supposed to hit. This worked out pretty well.

Moving the RSS Feeds

In the process of moving to the new server, my RSS feeds changed names. I had five different feeds. One for each site and then one that summarized all of them. I’ve decided to start using FeedBurner to host my feeds. So, after I switched to Movable Type and setup my feeds, I then setup more rules in the .htaccess file to redirect anyone who might be reading my feeds.

RewriteRule ^rss.xml            http://feeds.feedburner.com/TildeSterling [R=301,L]
RewriteRule ^frontpage/feed     http://feeds.feedburner.com/AndrewSterlingHanenkamp [R=301,L]
RewriteRule ^contentment/feed   http://feeds.feedburner.com/Contentment [R=301,L]
RewriteRule ^openscripture/feed http://feeds.feedburner.com/AndrewSterlingHanenkamp [R=301,L]
RewriteRule ^gabe/feed          http://feeds.feedburner.com/GabrielScottHanenkamp [R=301,L]

Now, all my feeds are permanently redirected to their new locations at FeedBurner.

The Design

The rest was the design work. I’m not going into detail here. Just look at it. I did it. That’s me and my shoddy Gimp/Photoshop work.

That’s It

That’s pretty much it. I’ve got some other stuff I’m planning, but that will probably take months more to get there.

One of my coworkers, Doug
, passed me a link to an article by Jakob Nielsen titled "Write Article's, Not Blogs
." The basic suggestion of the article is summarized as "To demonstrate world-class expertise, avoid quickly written, shallow postings. Instead, invest your time in thorough, value-added content that attracts paying customers." On the face of it, this does seem like good advice, but it makes a basic assumption that is false: blogs and articles fill the same role in business.

Now, to be fair, Nielsen does point out that blogs have value in business and we may not be that far apart in our opinions. However, I still must disagree on his statement that a serious business person should "not [spend] the effort to post numerous short comments on ongoing blogosphere discussions." He suggests that such time would be better spent writing serious and well-researched articles rather than short blog-style posts on topics. He suggests that this will result in more revenue for the serious business person because it avoids "commodity status."

The main disagreement I have is that this sort of statement is like saying that newspapers shouldn't have editorials, but only serious articles. Newscasts should only provide commentary, and skip general reporting. Football quarterbacks should focus on passing and give up running plays. Limiting yourself to a single dimension in your writing can also tell your audience that you don't care about what anyone else is saying, that you are the expert unto yourself. I find myself unimpressed with the sort of expert that can't find value in or contrast himself with the opinions of someone else. The kind of expert that is only capable of writing articles and not able to make concise and witty remarks without the aid of research.

Therefore, I say write blogs when you that's the appropriate medium for the message you have to deliver. If you read an interesting article and want to commend or disagree with the author, this is a blog. If you have an interesting discussion with a client that reveals something about your company's core values, write a blog. If you want to talk about something you see on the horizon as becoming a serious topic of discussion in the next year or two, write an article. There's nothing lost in short blog posts when applied to the right content. However, I do agree with Nielsen that far, serious writing requires a good and well-researched article.

Cheers.

I was going through my daily news reads today and came across this one
on Newsbusters
. It caught my attention because it was about O'Reilly ETech
, which was a conference I had considered attending this year. There's usually at least a few interesting things that come up each year and thought it would be educational. However, when I found out one of the speakers stayed home
because she was receiving death threats on her blog
and in other blogs, that's just freaky.

I don't know Kathy Sierra and I don't particularly care for the Head First series of books by O'Reilly, but what kind of a pathetic human being makes death threats? I hope the person or persons who perpetrated these death threats
are caught and prosecuted. It's illegal and the Internet must not provide any protection from this kind of behavior.

Cheers.

Cross-Site Drupal

I blog on a wide range of topics. Because of this, my blog one day might focus on Bible study and the next on a trip I took and the next on some site improvement I'm making on one of the web sites I maintain or help maintain. I'm guessing that some visiting my site probably get whiplash and probably have a hard time knowing what to pay attention to.

Solution: Crossite module. I've written a module I've dubbed "Crossite" which uses the multi-site features of Drupal to share nodes between them.

This solution provides a kind of ultra-cheap aggregation of information on the various sub-sites. All the sites share the users, nodes, taxonomy information, but have their own themes, settings, and cache. The main feature provided by this plugin does two things. First, a node is categorized as "belonging" to a given site based upon the taxonomy terms it has been filed under. If a node has no matching taxonomy terms, it is treated as if it belongs to the default site.

The second half of this functionality is a redirect that is performed when viewing nodes that belong to a different site. If you click on a link that leads to a node page for a site that belongs to another and does not belong to this site, you will be redirect to the node's page on that other site. A node might belong to multiple sites or all sites simultaneously if it has the correct terms attached to it. In fact, one term might even link a node to multiple sites.

A secondary feature is that it adds a new property to node objects, named "sites". This returns an array of sites to which the node belongs. This can then be used to determine how to theme pages or do other custom tid-bits.

I'd like to make a "Crossite_view" module to distribute with the parent module to further facilitate this by allowing sites to have specialized list views. The configuration of the system is a kludge and needs to be incorporated into the UI to make installation easier/possible. Right now, you have to modify the "settings.php" file for all the sites. Anyway, I'm waiting for my CVS account on Drupal.org before publishing the module.

In application, I've expanded my web site now to include two domains I've owned for awhile but had been hoping to use for other purposes. I don't think those other things are going to happen just now, but I wanted to use them in the meantime.

This site, Andrew.Sterling.Hanenkamp.com will focus on the "life" stories about things happening with me and my family, my general opinions, etc. I will also use this site as the primary aggregation site for all the other articles. The main list will feature those articles as other headlines between the "Life" articles. I will probably provide a master feed of all my web contributions as well. I'd like to have something like the Newsvine seed where I can pull in articles, comments, and other bits I post on other sites as well---such as links to my Boomer Bulletin articles.

I will feature technical stories about computing, Perl, Java, programming, web, software, Apple, Linux, etc. on Contentment. That site formerly hosted my CMS efforts, which are now defunct. I had, briefly, also planned on using it as a place to discuss church site development or provide project management tools to teams building church web sites. However, one is already being handled by the Churches group on Drupal Groups. The other proved to be too ambitious for me to do in the time I could spare between everything else I do when not at work.

My Bible studies will be featured on Open Scripture. This site reflects my desire to know my Bible and "Open Scripture" describes a kind of mini-motto that describes my take on the Christian life. I purchased this domain in the hopes of helping create some kind of Bible study/collaboration tools. Again this has proven to be too ambitious and probably premature. In the meantime, I will use it to share my personal Bible study.

My web site continues to evolve, bit by bit. It's kind of a fun little project to dink with every few weeks and is enough to keep me entertained at home.

Cheers.

1

Tags

Find recent content on the main index or look in the archives to find all content.