September 2008 Archives

When a user creates an entry or a page in MT, they are given the possibility of entering keywords in a separate field. If the field is not visible in your MT editing page, you can change the "Display Options". MT uses this data when it performs a search, but this data is not "visible" to Internet search engines.

Display OptionsIt should be noted that the code in this tutorial has a lot of conditionals, so it may not scale well for your whole blog. Which is to say if you have thousands of pages or entries, this may slow down your rebuild process... maybe a little or maybe a lot. How much really depends, on lots of things that are beyond the scope of this post.

Next to useless?

There is a standard HTML head element, which contains meta data. The standard does not define what kinds of meta data may be present, but one very commonly used meta element is keywords. It is sometimes referred to as meta-keywords or the <meta> keywords attribute. Google says that http-equiv attribute keywords is next to useless. In the same article they note that it is still the second most commonly used attribute value of the meta element.

How we did it at Kinetix

As always, we recommend making a new template and including it where applicable. This makes it easier to upgrade your customizations in the future if template sets change. And when have they not changed?

There are two template tags that refer to keywords, because both pages and entries can have keywords. The tags are: <mt:EntryKeywords> and <mt:PageKeywords>. This code is included in the all output HTML (pages, entries and archives) so it has to check which context it will be render for, and select the appropriate MT template tags to render. Additionally, The KinetixHosting site uses the Professional Template Set so the code takes into account the special condition of the home page.

<mt:If name="entry_template">
  <mt:IfNonEmpty tag="EntryKeywords">
   <meta name="Keywords" content="<mt:EntryKeywords>" />
<mt:ElseIf name="page_template">
  <mt:IfNonEmpty tag="PageKeywords">
   <meta name="Keywords" content="<mt:PageKeywords>" />
<mt:ElseIf name="main_index">
  <mt:Pages tag="@home" lastn="1">
    <mt:IfNonEmpty tag="PageKeywords">
      <meta name="Keywords" content="<mt:PageKeywords>" />

What, no keywords for the archive pages?

Well, its true. But those pages always represent a collection of entries. What would the correct keywords for the archives be? What do you think should be done in this case?