October 13, 2011

Targeting Your HTML

I thought I had blogged on this before but Blogger is being difficult, and I can't find the post. So I'm posting (reposting?) for reference, as there are some bloggers out there that still need to learn this lesson.

For all examples in this explanation, we are going to use [ and ] but when you write the actual code, you should replace them with < and >. Here is how you make a hyperlink in your blog post.

[a href="URL"]Site Name[/a]

Ta-da! Now users can link to a website from your site, and that's super nifty. There's only one problem. When they follow that link, they leave your site. You don't want readers to do that, especially if they're not done reading what you posted. The goal is to keep users at your site while providing them all the entertainment and information they need. You are an Oracle, a font of wisdom, but they'll never learn that if you're sending them elsewhere.

So what do we do? We target the hyperlink. There are various targets that have various applications, but in this situation, we only care about one of them. You want your hyperlinks to open in a new tab/window. (Whether it's a new tab or window is up to their browser settings so you don't worry about that.) How do you make the link open in a new tab/window? Like so:

[a href="URL" target="_blank"]Site Name[/a]

You don't need any punctuation to separate commands, so don't go adding a comma or anything. Write it just like I have it above and the next time someone follows one of your links, it'll open in a new tab, leaving your page still available to them so that when they're done reading what you linked to, they can easily return to your own content and continue to learn from your wisdom.

So let us practice:
[a href="http://www.penny-arcade.com/comic/2004/08/04" target="_blank"]Penny Arcade[/a] becomes Penny Arade once we replace the brackets with angle brackets.

Click on that link.

Welcome back! I assume that you read the comic and possibly a number of other archives but eventually you closed that tab and look, we're still here!

Wooo!

\m/(>.<)\m/

And there you go, kiddies. Now go forth and hyperlink correctly.

No comments:

Post a Comment