Jacob Rask's Lab

web stuff & who knows what else

Dynamic Tag Links

Problem

Linking relevant words internally to your tags can provide benefits both from a search engine optimization point of view and provide a relevant context for your users to keep exploring your site. When starting a new site though, you might not have a lot of tags in your archive yet, and you don't want to go through your old posts adding new relevant links each time you write a new article.

Solution

A Wordpress shortcode adds a link to the specified tag, but only if it exists. You can also specify several tags separated with semicolons, and let the plugin go through them.

Usage

[taglink name="tag1;tag2;..."]text[/taglink].

For instance:

[taglink name="css;web development;technology"]stylesheets[/taglink]

will output

<a href="http://yourdomain.com/tag/css">stylesheets</a> or 
<a href="http://yourdomain.com/tag/web-development">stylesheets</a> or 
<a href="http://yourdomain.com/tag/technology">stylesheets</a> or 
stylesheets

depending on which – if any – tag exists.

Note that rel="tag" is not added to the link, as that is meant to point to tags describing the current page, which is not the case for these links.