The Daily Dump

April 14, 2005

Blogging | Movable Type | Search Engine Optimisation

Optimising Movable Type for Google

For those that like to tinker, I found this enlightening post on optimising Movable Type for Google while looking for something else. A quick search found quite a bit on the topic (see links below). I decided to implement some of the suggested changes while my blog still has that new blog smell and also before it gets <cough /> referenced. For those interested in doing the same, here are some of the suggestions that I thought worthwhile.

(Note these changes are specifically for Movable Type 3.15. Some of the code below might not work for other versions. Also, please be aware that some changes will alter the permalinks of existing entries.)

Put the Full Title in the Individual Archive URL

Putting relevant words in the individual archive URL (the entry permalink) gives Google a big clue as to what the entry contains. By default Movable Type will put the first fifteen characters of the entry's title in the URL. This is great, unless the title is a bit longer and the first fifteen characters don't accurately reflect the contents of the entry. Take this entry for example. The default URL is "2004/04/optimising_mova.html". Optimising what? What's a mova? The full title would be better.

This is easy to change in Movable Type. In the blog administration screen click on Weblog Config, then on Archive Files. Here you can change the individual archive URL. The Archive File Template value for your Individual archive should be blank by default. Change it to...

<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryTitle dirify="1"$>.html

Dirify indicates that any URL incompatible characters (such as spaces) should be either stripped or converted to underscores instead. For this entry the URL will be "2005/04/14/optimising_movable_type_for_google.html". Much better.

(Note that I've added an extra directory for the day of the entry. This is because I use daily archives in addition to monthly archives. You can leave that out by removing "/%d" from the above line.)

There seems to be some discussion on whether underscores are the best replacement characters in URLs. The general consensus seems to be that hyphens are better. Again this is easy to change in Movable Type.

First of all you need to upload a plugin that will do this for you. There are several around, but I've chosen Dashify by Cal Henderson. The instructions that come with the plugin are pretty clear. Once it's uploaded, change your Archive File Template value to...

<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryTitle dashify="1"$>.html

The individual archive URLs will now have hyphens instead. For this entry the URL will be "2005/04/14/optimising-movable-type-for-google.html".

(Note if you want to know what the <$MTWhatever$> code is all about, the Movable Type documentation has everything you need to know. Click on Help in the blog administration screen and navigate to the Template Tags section.)

Put Keywords in the Individual Archive URL

Sometimes your title doesn't reflect the contents of your entry accurately. Take my first entry for example. The title, "First Entry", doesn't really describe what I'm talking about. A better description would be "Community Server vs Movable Type". If I could get that into the URL instead of the title, Google would like my entry just that little bit more.

To do this in Movable Type the first thing to do is to turn on keywords. In your blog administration screen click on New Entry and scroll to the bottom. Click on Customize the Display of this Page. Once there, choose Custom and check all the checkboxes, including Keywords. This will provide a keywords box to fill in when constructing a new entry.

The next thing to do is install the MTIfEmpty plugin by Brad Choate. Again the instructions that come with the plugin are pretty clear.

Finally, in the blog administration screen click on Weblog Config, then on Archive Files. Change the Archive File Template value for your Individual archive to this...

<$MTArchiveDate format="%Y/%m/%d"$>/<MTIfNotEmpty var="EntryKeywords"><$MTEntryKeywords dashify="1"$><MTElse><$MTEntryTitle dashify="1"$></MTElse></MTIfNotEmpty>.html

If an entry has keywords, the keywords will be used in the URL. If not, the title will be used instead. Since my first entry has the keywords "Community Server vs Movable Type", the URL will now be "2005/04/13/community-server-vs-movable-type.html".

Dashify Category Archives

If you're using a category archive, you'll notice that Movable Type creates a directory for each category. By default the directory name is dirified, meaning spaces will be replaced with underscores. Since we're already using hyphens for our individual archive URLs, we might as well use them for our category directories as well.

In the blog administration screen click on Weblog Config, then on Archive Files. The Archive File Template value for your Category archive should be blank by default. Change it to...

<$MTArchiveCategory dashify="1"$>/index.html

Not a big change, but the underscores will now be hyphens instead.

Move the Individual Archive Link from the Time to the Title

By default the blog main page has a link to the relevant individual archive page on the time of each entry. The time (and the link) appear at the bottom of the entry where it says "Posted by Adam Boddington at 12:06 AM". The category and date-based archive pages also do this.

I'm not sure why Movable Type links the time of the entry by default, but Blogger seems to do it as well. Perhaps they do this for usability or perhaps it's blog convention, but linking "12:06 AM" might give a search engine the wrong idea about what the entry contains. Linking the title instead will give Google a bit more information on what the entry is actually about and will hopefully increase the visibility of the entry. Think of it as positive reinforcement.

Putting a link on the title is easy to do in Movable Type. In the blog administration screen click on Templates and then on the Main Index template. Search for the following line...

<h3 id="a<$MTEntryID pad="1"$>"><$MTEntryTitle$></h3>

Change it to...

<h3 id="a<$MTEntryID pad="1"$>"><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></h3>

It makes sense to also remove the link from the time of the entry, so search for the line...

<p class="posted">Posted by <$MTEntryAuthor$> at <a href="<$MTEntryPermalink valid_html="1"$>"><$MTEntryDate format="%X"$></a>

Change it to...

<p class="posted">Posted by <$MTEntryAuthor$> at <$MTEntryDate format="%X"$>

Rinse and repeat for both the Category Archive template and the Date-Based Archive template.

Emphasise the Entry Title

There are a couple things to do here. First of all, if you look at your templates you'll notice the entry title is marked up by a <h3> tag. <h1> is reserved for the title of blog and <h2> for the description of the blog and the date of the entry. Google puts more emphasis on text in <h1> and <h2> tags than it does on text in <h3> tags. I don't want Google to think "April 14, 2005" is more important than "Optimising Movable Type for Google", so I'm going to switch things around a bit. I'll switch <h1> for <h3> and vice versa.

To do this, in your blog administration screen click on Templates. For each of the following templates...

  • Main Index
  • Master Archive Index
  • Category Archive
  • Date-Based Archive
  • Individual Entry Archive
  • Comment Listing Template
  • Comment Preview Template
  • Comment Error Template
  • Comment Pending Template
  • TrackBack Listing Template

Perform the following process...

  1. Copy the template text to your favourite text editor.
  2. Search and replace "<h3" with "<h1temp".
  3. Search and replace "</h3>" with "</h1temp>".
  4. Search and replace "<h1" with "<h3".
  5. Search and replace "</h1>" with "</h3>".
  6. Search and replace "<h1temp" with "<h1".
  7. Search and replace "</h1temp>" with "</h1>".
  8. Copy the text back to the template and save.

If you have a text editor that can perform search and replace across multiple files, or record macros, life becomes easier.

Next, open up the Stylesheet template and switch around the "h1" and "h3" styles to match accordingly (they may show up more than once). Save and rebuild.

The other thing to do is to make sure the title of the entry is the title for the individual archive page. Text marked up by the <title> tag gets priority by Google. By default Movable Type has the blog name as well as the entry title in the title of the individual archive page. The blog name is really redundant here and isn't going to help others choose your page in the Google search results (where the page title is the first thing displayed). Best to emphasise just the entry title, so go ahead and remove the blog name from the individual archive page title.

(Note that while Nicholas Carvan recommends doing this, both Roger Johansson and Mark Pilgrim suggest otherwise. If you would like to leave your blog name in, it might be a good idea to follow Roger's suggestion and place it after the entry title instead.)

In the Individual Entry Archive template find the following line...

<title><$MTBlogName encode_html="1"$>: <$MTEntryTitle$></title>

Replace it with...

<title><$MTEntryTitle$></title>

Or...

<title><$MTEntryTitle$> | <$MTBlogName encode_html="1"$></title>

Turn on Daily Archives and Fix the Calendar

The last thing isn't so much a Google optimisation but rather something that just makes sense to me. My first two entries were posted on the same day so I noticed straight away that clicking on the calendar on the main page did not take me to both entries, but rather to the last entry for that day instead. I would prefer to go to both entries -- luckily this is easy to fix.

The first thing to do is turn on the daily archives. This will provide something for the calendar to point to. In the blog administration screen click on Weblog Config, then Archive Files. There is a Daily Date-Based Archive already there, it just needs to be turned on. Check the checkbox and save the changes.

Next, click on Templates and open up the Main Index template. Search for the following line...

<MTCalendarIfEntries><MTEntries lastn="1"><a href="<$MTEntryPermalink$>"><$MTCalendarDay$></a></MTEntries></MTCalendarIfEntries>

Replace it with...

<MTCalendarIfEntries><a href="<$MTArchiveLink archive_type="Daily"$>"><$MTCalendarDay$></a></MTCalendarIfEntries>

You can see the entry permalink has been replaced with a link to the daily archive instead. Voila, fixed!

Links

Optimizing Your Movable Type Blog for Google by Nicholas Carvan
A lot of good information on how Google works and on the importance of link text, <h1> tags and putting the title in the URL. Also some discussion on removing the blog name from the individual archive page title.

Basics of Search Engine Optimisation by Roger Johansson
A very good guide on general search engine optimisation.

My Movable Type Installation by Anders Jacobsen
How to put the entry title in the URL and also some general archiving strategies.

A (Hopefully) Seamless Migration from Underscores to Hyphens by Tom Sherman
A guide on using hyphens instead of underscores (dashify instead of dirify). Also some good information on making this change seamless for existing entries.

Cal's Dashify Plugin by Anil Dash
Describes the plugin and provides a link.

Cruft-Free URLs in Movable Type by Mark Pilgrim
Has the code for putting keywords in the URL instead of the title. Also a lot of other information on removing cruft from Movable Type URLs (which I haven't implemented as yet).

MTIfEmpty by Brad Choate
A direct link to the MTIfEmpty plugin on Brad's site.

Day 8: Constructing Meaningful Page Titles by Mark Pilgrim
Some page title strategies for all the different types of archives.

Archive Links on the Calendar by Nick
The calendar quick fix.

Posted by Adam Boddington at 12:06 AM | Comments (0)
Keywords: Optimising Optimizing Movable Type for Google

Comments

Post a comment




Remember Me?

(you may use HTML tags for style)