« Edit This Post Buttons for the Footer of TypePad Blogs | Main | I'm a Panelist on Blog Design at BlogWorld »

John T. Unger

Custom Head Module Reference Page

John T. Unger October 14, 2007

I use a customized head-common module on most projects to set the autodiscovery feed to serve up a FeedBurner feed rather than default TypePad feeds and also for changing the default title structure of pages to be more search engine friendly.

There are at least three major benefits to creating a custom head-common module.

  1. If you want to make your FeedBurner feed the default feed for autodiscovery, you can find instructions in this article in the Knowledge Base: Advanced Templates: Setting Feeds for Auto-Discovery. (Caveat: the Knowledge Base article instructs you to paste the code for these modules directly into your page templates, which will work just fine, but makes later edits to the code a real pain. It's much better to set use the modules as separate elements as described in the extended post below. The only one you need to edit once they're set up is the head-common module.)
  2. You can edit the title tags for your pages and archives as discussed in this hack: Rank Better in Google by Adding Dynamic Title Tags to your TypePad Blog.
  3. If you need to include a piece of JavaScript on all your pages (for stats, ads or other hacks that require JS) pasting it into the end of this module is the best way to do so. In some cases, it's better to put the JS in a sidebar instead. The rule of thumb is this: for scripts that should load before the rest of the page, use the head-common module. For scripts which may significantly slow the page-load speed and are not needed to display elements of the page, use the sidebar. Example: a script for ads should go in the head-common module, where scripts for stats might better be added at the end of the right-most sidebar.

If you'd rather, you can skip the modules and paste the head information for your blog at the beginning of each of your page templates, but I find that the modules save a lot of time. By using the head-common module for code that need to be on every page, you can make later edits by modifying only one module rather than six or more templates.

Because the head-common module is included by the head-index, head-individual, head-category, and head-date-based modules, you will also need to create custom versions of the modules which include it before you can use it in your templates. Example code for all these modules are available in the Knowledge Base, but they're scattered across multiple articles and there isn't a single page that lists them all. I've been meaning to collect them all into one place for a while and you can now get them in the extended entry for this post along with instructions for how to use them.

How to customize your head tags in TypePad

  1. Log into your TypePad account and go to the Design tab for the blog you wish to edit.
  2. Click on Create new template module towards the bottom of the page.
  3. Give your new template a name of head-common by typing it in the Template Name field.
  4. Paste the code for the head-common module into the Template Body field.
  5. Click Save.
  6. Repeat steps 1-5 for each of the template modules below.
  7. Republish your blog, selecting "Publish Indexs Only" in the pop-up window.
  8. Return to the Design tab and open your Main Index Template (or select it in the drop down menu).
  9. The first line of the template should read:
    <$MTWeblogIncludeModule module="head-index"$>
    Replace that line with the line:
    <$MTInclude module="head-index"$>
  10. Click Save.
  11. NOTE: if you have created any custom index pages based on your main index template code, you will want to repeat step 9 & 10 with each of those.
  12. Go to your Archive Index Template and replace
    <$MTWeblogIncludeModule module="head-archives"$>
    with <$MTInclude module="head-archives"$>
  13. Click Save.
  14. Go to your Category Archives Template and replace
    <$MTWeblogIncludeModule module="head-category"$>
    with <$MTInclude module="head-category"$>
  15. Click Save.
  16. Go to your DateBased Archives Template and replace
    <$MTWeblogIncludeModule module="head-date-based"$>
    with <$MTInclude module="head-date-based"$>
  17. Click Save.
  18. In both the Individual Archives and Pages Templates replace
    <$MTWeblogIncludeModule module="head-individual"$>
    with <$MTInclude module="head-individual"$>

TypePad Head Tag Modules

Module Name: head-common
This module is included by the head-index, head-individual, head-category, and head-date-based modules all of which are provided below. I've already altered the code of the other modules to reference your new custom head-common module instead of the standard module created by TypePad.

Module Name: head-index
This module is included by the main-index template.

Module Name: head-individual
This module is included by the Individual Archives and Pages templates.

Module Name: head-category
This module is included by the Category Archives template.

Module Name: head-date-based
This module is included by the DateBased Archives template.

Module Name: head-archives
This module is included by the Archive Index Template.

Comments

john t unger says:

Hi Georgianna,

Oops, my bad…

I've added the module you requested at the bottom of the list. I think it got skipped because I typically don't use the archive template (and sometimes even remove it). All it does is make a page with links to your dae and category archives and I've always though that it was better to do that with lists or drop-downs in the sidebar (or sometimes within the navigation bar).

Thanks for the note though! I shouldn't have included it in the first part of the instructions unless it was also in the second part!

Steve Martocci says:

Hi John,

Great article, really helped me update my head quick. One thing though...

In your category and archives link you seem to be using this tag (<$MTWeblogIncludeModule module="head-common"$>) instead of what I think it should be <$MTInclude module="head-common"$>

Thanks :)

The comments to this entry are closed.

TrackBack

TrackBack URL for this entry:
https://www.typepad.com/services/trackback/6a00d8341c4fdf53ef00e54ef7652d8833

Listed below are links to weblogs that reference Custom Head Module Reference Page:

typepad hacks is a typepad featured weblog typepad hacks is listed on Alltop social media

Subscribe

Email RSS Comments  
Subscribe to TypePad Hacks with email Read TypePad Hacks posts via RSS Join the conversation at TypePad Hacks via RSS (comments feed) subscriber count

Search

Socialize

Twitter Logo
    follow typepadhacks on twitter

    Read and reply to the 100 most recent comments at the TypePad Hacks Community Page


    Grazr

    Colophon

    Powered by TypePad
    Member since 03/2005

    TypePad Status

    Creative Commons License