Adding Tag Support to MovableType

Joey asked how I implemented tag in my MovableType. I didn’t used plugin. Here is the cookbook to add tag as this blog.

Use Categories in the Tagging Way

First thing is, use the built-in category feature in the tagging way. When you want to assign some tags to an entry, just assign multiple categories. Thanks to the features of MovableType, you can easily add a new category (a new tag). It is not free form, but good enough.

Below is the list of tags I have:

screen-categories-mt.PNG

The list is long.

Adding Tag Chart to Template

One of the key feature distinguishing tags from other category or keyword based classification is, tag chart or tag cloud. Like this:

screen-tag.chart-mt.PNG

In Category Archive template, use the following code:

<!–tagging map–>

<p class=Headlines><MTCategories>

<a style=”text-decoration:none” href=”<$MTCategoryArchiveLink$>” title=”<$MTCategoryCount$>”><$MTCategoryLabel$></a>

</MTCategories></p>

<script language=javascript>

e = document.getElementsByTagName(“A”);

for(i=0; i < e.length; i++)

{

if(e[i].title != “”)

{

t = e[i].title;

if(t > 256) e[i].style.fontSize = “150%”;

else if(t > 126) e[i].style.fontSize = “140%”;

else if(t > 68) e[i].style.fontSize = “130%”;

else if(t > 16) e[i].style.fontSize = “120%”;

else if(t > 8) e[i].style.fontSize = “110%”;

else if(t >= 2) e[i].style.fontSize = “100%”;

else if(t = 1) { e[i].style.fontSize = “80%”; }

}

}

</script>

<!–end of tagging map–>

The codes (including the VBScript) are self-explained.

You can put this piece of code to other pages, like homepage.

Done

It is just as simple as using the existing functions to create a new way of presentation. Anyway, categories, keywords, and tags are not too different in nature.

Happy blogging!

1 thought on “Adding Tag Support to MovableType

  1. o,that’s a good idea,thank you.

    Using the existing functions to create a new way of presentation,hoho,so powerfull of MovableType.

Leave a Reply

Your email address will not be published. Required fields are marked *