This post describes the modifications I have made to TypePad’s Advanced Templates to insert a noarchive tag, intended as an opt-out from Google’s cache. Working with Advanced Templates requires a minimum Pro membership, and if anyone knows how to do it more simply (on TypePad), please tell the world, because I was not able to find an alternative.
Adding noarchive to Advanced Templates
My first step, since I’d not already done it, was to create a set of Advanced Templates from the customized templates of this blog, as described in TypePad’s support knowledge base (Creating an Advanced Template Set ID53). (The support knowledge base links are dynamically generated, so I’m going to cite the ID and avoid broken links if there’s a restructuring.)
The strategy described in Advanced Templates: Creating and Customizing Template Modules (ID542) comes down to creating new versions of the template modules that are to be modified, and then amending the line(s) of code in all the templates where the default template modules are included –
<$MTWeblogIncludeModule module=”module-name”$>
to include the modified module:
<$MTInclude module=”module-name”$>
Straightforward enough in principle, however, for efficiency, the modules are nested – modules are included within modules within templates. Things got complicated, and required reference to multiple reference articles and a query or two to Typepad support (who referred me back to the reference articles).
There is a common header module: head-common.
It is included in the following specific header modules:
- head-archives
- head-category
- head-individual
- head-index
- head-date-based
- (supposedly) head-extra.
These modules in turn are included in the following templates:
- head-archives in Archive Index Template
- head-category in Category Archives
- head-index in Main Index Template
- head-date-based in Datebased Archives
- head-individual in Individual Archives, Pages
I had to create new modules for head-common, head-archives, head-category, head-individual, head-index, and head-date-based, based upon the code provided on various support knowledge based templates. I could not find code for head-extra, which I understand is an additional module.
Then I had to edit all the relevant Index and Archive templates to incorporate the new modules.
Common header module: head-common
Code for head-common is provided on the page Advanced Templates: Shared Template Modules (ID534). There are a couple of omissions in the list of where head-common is included.
head-common contains the code controlling the behaviour of robots for blogs set to private (enclosed in the MTBlogIfPrivate tag). Initially I thought about modifying the code, but decided to leave the code in and add a new line, so that in the unlikely event I decided to revert a blog to private I wouldn’t trip myself up. The line is (nofollow is optional).
meta name=”robots” content=”noarchive,nofollow” /
Add the angled brackets fore and aft; even with a blockquote to protect it, TypePad’s publishing system is suppressing the line with the angled brackets in.
I created a new template module, called it (for example) head-common-mod, cut and pasted the default code, and inserted the new line. I saved, but did not publish at that point.
Individual header modules
Since head-common is included by head-extra, head-archives, head-category, head-individual, and head-index, all these modules had to be replaced by an extra module, based upon the default modules, but amending the include code:
<$MTWeblogIncludeModule module=”head-common”$>
to:
<$MTInclude module=”head-common-mod”$>
Default code is found in the following pages in the knowledge-base:
- head-archives in Advanced Templates: Archive Index Template (ID 544)
- head-category in Advanced Templates: Category Archives Template (ID 545)
- head-index in Advanced Templates: Main Index Template (ID 548)
- head-individual in Advanced Templates: Shared Template Modules (ID 543)
- head-date-based in Advanced Templates: DateBased Archives Template (ID 546)
See also Advanced Templates: Template Modules (ID 137), which lists all the types of template modules.
In each instance, I created a new template module, named it appropriately, cut and pasted the default code, and edited the required line. I saved, but did not publish.
Templates
The templates themselves are accessible through the control panel: TypePad Home > Your Weblog > Weblog Name > Design. In all instances, the edit is the same, only the module name is different:
<$MTWeblogIncludeModule module=”module-name”$>
to:
<$MTInclude module=”module-name-mod”$>
The edits are:
- head-archives in Archive Index Template
- head-category in Category Archives
- head-index in Main Index Template
- head-date-based in Datebased Archives
- head-individual in Individual Archives, Pages
Publication
Having saved all the module and template changes, I republished the blog and checked to see if anything is broken. On inspection, Incidental Findings looks all right, unlike the first time, when I interpreted the instructions around head-extra as allowing insertion of additional code and nixed my layout. The controlling tag is appearing when I look at View Source. It will take a while for me to determine whether my entries are still being indexed but without the Cached link, which is the objective of the exercise – and whether it has broken anything else!