Tuesday, February 20, 2007

How to Post a Website in a Comment

Frequently my readers know of resources or documents relevant to my postings and you post them in the comments. It's great, like an intelligent search engine. Some of the URLs are long, and sometimes they appear truncated or overflow the column. There's an easy way to prevent that. I usually start by explaining how something works, and then get to the result, but today I'll do it backwards. The following line is all you need to know.

<a href="http://www.website.com">text to click on</a>

If you want to post a comment with a URL in it, all you need to do is highlight and copy the above line, and paste it into the comment box. Then you can edit it to insert the real website URL, and the text to click on. Be careful to leave the quotation marks in place around the URL. That way you can type a really long URL but all that displays in the comments are the words you link to, the text to click part of the formula. The text to click on will automatically be displayed like that: underlined and/or in a different colour so that people know they can click it.

In case you want to know what that means, I'll tell you. But you can ignore this paragraph if you don't care or already know. When you tell a webpage to display something you use tags. The tags tell the computer what to do with the part in between, whether it should be displayed as a picture or a paragraph, how big it should be, what colour, what style and if it is connected to other text. The tags go before and after the stuff you want to display, like the opening and closing credits of a movie, except instead of theme music you get angle brackets. The less-than sign is the opening angle bracket. A link comes under the category of "anchor"--you're hooking your text to the text on some other webpage. So a is the opening tag. After that comes a code specifying the kind of anchor, a hypertext reference, so href. And then you specify the reference itself, the URL in quotation marks. And that's the end of opening tag, so you close the angle brackets, giving <a href="http://www.neatwebsite.com">. Don't put a space after the >, just type the text you want clickable right up against it. (It will still work if you leave a space, it will just look dumb). And then after the clickable text, you type the closing tag. The closing tag is simply the opening tag preceded by a slash: that's the bottom-to-top, left-to-right slash that is on the same key as the question mark. </a>. Done.

There's another strategy for making long URLs managable, and that's a service like tinyurl. You can paste any URL you like into the window at that site, and it will give you back a gobbledegook URL that is very short. That is very useful if you have to write down a long URL or dictate it over the telephone. I prefer to see the real URLs on websites, so I have some idea where I am going before I go there. I can't tell whether http://www.tinyurl.com/ad45g is cartoons, porn or airplanes. Also I can't click on it. I have to open a new browser to copy and paste into. Whereas if someone links to something directly, like this I can check it out in advance if it seems to be a good neighbourhood on the internet by placing my mouse over it and looking at the bottom of my window before I click. You'll see the one above takes you to "nastystuff.ca" which probably doesn't exist, but doesn't sound like a good place to go for information on fireproof lifejackets.

Nothing to do with airplanes, but at least it's not the same story as last week.

Oh and you're all welcome to post your websites or other favourite URLs in the comments just for practice.

Thursday, February 15, 2007