Not a developer? Go to MovableType.com

Documentation

TagSearchLink

A variable tag that outputs a link to a tag search for the entry tag in context. The tag context is created by either an EntryTags or a Tags block.

Like all variable tags, you can apply any of the supported global tag modifiers to TagSearchLink to do further transformations.

Examples

The example below shows a tag cloud where each tag is linked to a search for other entries with that tag assigned. It can just as easily be used to link entry tags within an EntryTags loop.

    <h1>Tag cloud</h1>
    <div id="tagcloud">
        <mt:Tags>
            <h<$mt:TagRank$>>
                <a href="<$mt:TagSearchLink$>"><$mt:TagName$></a>
            </h<$mt:TagRank$>>
        </mt:Tags>
    </div>

The search link will look something like:

http://example.com/mt/mt-search.cgi?blog_id=1&tag=politics

Using Apache rewriting, the search URL can be cleaned up to look something like:

http://example.com/tag/politics

A URL like this would have to be built like this:

<mt:EntryTags glue=", ">
    <mt:BlogURL>tag/<mt:TagName normalize="1">
</mt:EntryTags>

And of course, you would have to create the .htaccess rules to translate this into a request to mt-search.cgi:

RewriteEngine On
RewriteRule ^tag/(.*)$ /mt/search.cgi?blog_id=1&tag=$2&limit=20 [L]
Back

Leave a Comment