Jelle Druyts .NET Consultant
Just another ignorant weirdo from Antwerp, Belgium trying to make sense out of it all
Ok so I'm not a usability expert on adding all kinds of semantic tags to the html for people with reading problems and such. I've read about it, I've seen it in action, and I understand the point and the need, but these things go pretty far and deep. So for blogs (to name an obvious example) I actually expect the engines and their templates to take care of this for me. My previous engine (nucleus) was pretty good at this really. But there are two few things that I explicitly do pay attention to myself just because there's fairly easy to implement or because it just makes the world a better place. (Right. Like any of this really matters. Anyway.)
One of them has to do with the regular expression I talked about in my blog migration post. Thanks to all of you for playing along with your numerous comments by the way The point is, when I'm browsing I want to know if a link will take me someplace outside the current site and if it will open a new window. As a precaution, I wind up right-clicking and choosing "Open in New Window" far too much... So I pumped this simple expression into dasBlog to replace all occurences of href="?(?<expr>http[^"\s]+)"? with href="${expr}" class="external" target="_blank". What this does is just take all hyperlink references that point to a place starting with http and add the mentioned class and target attributes to them. Indicating that it's an external link is done with the CSS class "external", which renders an external link differently than an internal one (hover over the nucleus link and the link to my other post above and note the difference). Opening a link in a new window is done by using the _blank target as you may know. Now this works on two simple assumptions:
href="?(?<expr>http[^"\s]+)"?
href="${expr}" class="external" target="_blank"
class
target
_blank
By the way, the HTML 4.01 specification defines a rel attribute on a hyperlink that indicates the relationship between the document and the link target. Unfortunately it doesn't define an "external" link type that would specify the link will take you to an external site. There's an article about "New-Window Links in a Standards-Compliant World" that talks some more about this and provides a javascript that implements the behaviour I'd like to see - but I'd really like the browser to take care of this plumbing (like rendering it differently and having options to always open it in a new window for example). However, most browsers, like IE, don't support the attribute yet
rel
So that one's automated, the other thing I really try to hold myself to, is having meaningful hyperlinks. I really hate the "click here" style link that I'm certain served its purpose well in the early 90's when pretty much nobody had a clue what to do with a webpage or a link, but since then I think the web has become less about typing and more about writing (at least I hope so). A link should not be breaking your prose, it's not supposed to surface to the sentence flow. It's a way of navigating from one place to another, so the link's text should indicate by itself where it's taking you. A less obvious but nevertheless non-discardable advantage these days (where "knowledge" and "searching" are key, listen to any WinFS talk to convince yourself): while spidering your site, search engines like google can add their search semantics (metadata) to the link you're providing using the link text. So you are adding semantic value to other people's sites - where otherwise, the only semantics come from the site's owner. Pretty powerful I'd say.
Anyway, I'm off in that zone again, snapping back out of it now... If you got this far, at least you'll know when clicking a link on my site will open a new window