« prev next »

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!


by Jian Shuo Wang on March 8, 2006 under MovableType

Related Entries: MovableType
  1. Six Apart's Problem? February 22, 2009
  2. Track Click on Elements February 22, 2009
  3. Short Pause of Comment System January 20, 2009
  4. MovableType 4.2 is Disappointing June 8, 2008
  5. Subscription Enabled on This Blog April 23, 2008
  6. MovableType Dirify Change for UTF-8 December 23, 2007
  7. MovableType 4.01 and Bluehost CPU Exceeded Error November 16, 2007
  8. Wangjianshuo's Blog Template Archives 2007 November 5, 2007
  9. FeedBurner is a Useful Service August 28, 2007
Comments

o,that's a good idea,thank you.
Using the existing functions to create a new way of presentation,hoho,so powerfull of MovableType.

Posted by: Joey on March 10, 2006 9:04 AM
Post a comment
Name:

Email Address: (will not show)

URL: (optional)

Comments:


It may take up to 30 seconds before the server returns a result. IP address recorded.
Remember my information?
<-- Please click POST only once
© 2001 - 2009 Jian Shuo Wang. All right reserved .