Hi,
I wanted a way of designating external links, either with a graphic or a different colour, because this can be an important feature of usable/accessible websites.
If your clients use Textile (like mine) or a WYSIWYG editor then you may not be able to ensure that they apply an appropriate class to such links (until attribute selectors are widely supported). This plugin enables you to do that.
Wrap {exp:external_links} around text you wish to process. There are two parameters:
class="the CSS class you wish assigned to external links” (will default to ‘external-link’ if you don’t specify a class)
local="the site domain name”
So, assuming your domain is ‘myblog.com’ then this:
{exp:external_links class="external" local="myblog.com"}
<p>Lorem ipsum dolor sit amet, <a href="http://www.anotherblog.com">consectetuer</a> adipiscing elit. Aenean eros ipsum, egestas non, <a href="http://www.myblog.com/gallery/">hendrerit</a> a, sollicitudin non, magna. Duis lacinia massa.</p>
{/exp:external_links}
will output this:
<p>Lorem ipsum dolor sit amet, <a href="http://www.anotherblog.com" class="external">consectetuer</a> adipiscing elit. Aenean eros ipsum, egestas non, <a href="http://www.myblog.com/gallery/">hendrerit</a> a, sollicitudin non, magna. Duis lacinia massa.</p>
It is will take href attributes like ‘title’ into account and place the class at the end of them.
NB: This doesn’t yet work properly with external links that have query strings.
I hope someone else finds this useful.
Cheers
Dry
