Other Entries

Log

Delinking the Current Page in MovableType

A page shouldn’t link to itself.

It’s a general usability rule and just good practice. It’s always bothered me that MovableType doesn’t include logic to unlink the current page. I finally decided to fix it.

It’s only a problem for my site on the subject and monthly archive pages and I originally I thought about writing a plugin to target those two situations. Of course, ideally it would be more generic, which is where my reservations started.

After some research, I realized that it would be far easier to combine two existing plugins to do the work: Compare, and SetVarBlock.

Here’s a code snippet for the category template:

<MTSetVarBlock name="thispage"><$MTArchiveCategory$></MTSetVarBlock>
<ul>
  <MTCategories show_empty="1">
  <li><MTIfNotEqual a="[MTGetVar name='thispage']" b="[MTCategoryLabel]">
    <a href="<$MTCategoryArchiveLink$>">
  </MTIfNotEqual>
  <$MTCategoryLabel$>
  <MTIfNotEqual a="[MTGetVar name='thispage']" b="[MTCategoryLabel]">
    </a>
  </MTIfNotEqual></li>
  </MTCategories>
</ul>

And for the monthly archives:

<MTSetVarBlock name="thispage"><$MTArchiveDate format="%B %Y"$></MTSetVarBlock>
<ul>
  <MTArchiveList archive_type="Monthly">
  <li><MTIfNotEqual a="[MTGetVar name='thispage']" b="[MTArchiveDate format='%B %Y']">
    <a href="<$MTArchiveLink$>">
  </MTIfNotEqual>
  <$MTArchiveDate format="%B %Y"$>
  <MTIfNotEqual a="[MTGetVar name='thispage']" b="[MTArchiveDate format='%B %Y']">
    </a>
  </MTIfNotEqual></li>
  </MTArchiveList>
</ul>

01/28/05 02:17PM Accessibility and Usability Design Geekiness

Recently Played on iTunes

  1. “My Sharona”
    Frat Rock: The '70s
    The Knack
    06/04/11 09:27
  2. “The KKK Took My Baby Away”
    Anthology
    The Ramones
    06/04/11 09:25
  3. “My Sharona”
    Frat Rock: The '70s
    The Knack
    06/04/11 09:24

Last 100 Songs >