Machines should work, people should think
I considered it a good idea to add icons to links to make them noticeable. for internal links and for external ones.
At first we should draw pictures and add classes to style sheet
background:transparent url(/files/images/linkext.png) no-repeat scroll right center;
padding:2px 15px 2px 0px;
}
.linkint {
background:transparent url(/files/images/linkint.png) no-repeat scroll right center;
padding:2px 15px 2px 0px;
}
But then we must walk around all the links and add appropriate classes… Why? “Machines should work, people should think”! This motto becomes especially pleasant when somebody has already thought before you 😉 and created plugin for WordPress which replaces text on the fly during page generation using regular expressions.
I made all the internal links relative without http://
so the thing is just to install re.place plugin and add two simple rules. The first inserts class="linkext"
into external links replacing
by
and the second inserts class="linkint"
into internl links replacing
by
The second rule order must be greater then the first to make this replacements work properly.
According to the first rule the string class="linkext"
will be inserted into external links and they will not be recognized by <a *href=([^>]*)>
pattern.
The patterns contain < and > symbols so do not forget to set “Escape HTML characters” option in re.place “List view options” for proper displaying of re.place rule list.