Saturday, January 15, 2005

The Right Way to Link To Pages On Your Site

The Right Way to Link To Pages On Your Site:
By Dave Taylor

“Here's a topic that should be obvious, but isn't: how should you best code links on your site from page to page? Should you use something like "page two" or "continued..." or "more" with the page filenames as the links? Should you use absolute links that always begin with a leading / (as in "/reviews.html"), should you always use relative links (as in "../reviews.html") or should you use fully qualified links (as in "http://www.informit.com/reviews.html")?

The answer to this question might surprise you! First off, innuendo and rumor aside, Google and other search engines do not care about how your links are coded. I have read on some SEO (search engine optimization) sites that people suggest that Google "spiders" your site faster if you have absolute or even fully-qualified URLs, but as far as I can ascertain, that's just not true.

So this facet of the question boils down to what's the easiest for you to maintain on your site? A link that allows you to move all the pages around as you might need to reorganize things, or a link that forces you to always live with a specific domain name and directory name? My druthers is unquestionably to use relative links as much as possible, and to always use absolute (though not fully-qualified) links on 404 error pages and other content that kind of floats around on your site.

The only area where full, absolute URLs are a necessity are weblog entries, because your Weblog entries should be generating an RSS feed which is then read by subscribers in their own applications, so relative links almost always fail. This means that it's a bit more tricky to add links to certain content – especially if it is built around the Movable Type (or other) weblog content management system -- but the trade-off of having clickable links in the RSS feed makes it worthwhile.



http://www.informit.com/articles/article.asp?p=361413

No comments: