xref: Add Links To Pages Automatically | WebReference

xref: Add Links To Pages Automatically

By Dan Ragle


Available in static JavaScript and dynamic (with a Perl backend) flavors, the WebReference xref script is a traffic-building tool that enables you to automatically insert links into your Web pages whenever a key term is encountered on the page. You can both use the script on your own Web pages (to be certain you are creating links for those key terms consistently throughout your site), as well as offer the script to your affiliates, so their pages can also automatically include links back to your site. Including the script on your pages (or on your affiliates) requires only a single line of JavaScript; and affiliates can link directly to your copy of the script, if you prefer (i.e., affiliates need not copy the script and install it on their own Web servers; they only need to insert the necessary JavaScript command on their pages to activate the script).

What Is xref?

When included in a Web page, xref will examine the text of that page, looking for predefined key terms within it. When such a key term is found, the script automatically converts that term into a clickable link, with the link itself also going to a pre-defined URL (a page that further describes the term, or is somehow directly related to the term in question). A predefined title will also be applied to the term (which most modern browsers will display when the user hovers over the link), if so desired.

As an example, let's say that we operate a site that focuses on healthy eating. Within our site, we have several reference pages that are each dedicated to a specific type of food, describing their long-term benefits or harmful effects. It would be beneficial to us, from a traffic building standpoint, to be able to include links on all of our pages back to the reference pages whenever these foods are mentioned in our posts. Such links would also be helpful to our visitors, since the pages they point to will provide additional information pertaining to the food that may not be immediately available within the context of the page they're reading.

Let's further say that we've attempted to keep up with this process manually in the past; adding links to the reference section pages as we've generated new content for the site. Over time, the links and the reference section has gotten out of sync. We've removed pages from the reference that were no longer useful, or added new pages. Without some type of intervention (a good CMS, some back-end redirection, or just good old fashioned manual effort) the links in our original content won't accurately reflect the current status of our references.

xref allows you to define those reference terms and links in a single place--namely, the xref script-- then include the script in your pages such that it will automatically insert the links each time a visitor reads the page. Here's a live example, using links to Wikipedia for several selected fruits:

Note the links to the fruits in the above brief paragraph. The important thing to realize it that those links were not included in the original code of this page (feel free to view the source code to verify this for yourself if necessary); but were instead inserted automatically by xref. You can therefore include xref on all your pages and keep your reference links up to date automatically!

Of course, if you have a good CMS and/or good server-side tools, then you're already keeping up with your links and may feel you don't have a need for xref. And that may very well be true for your site. What about your partners and/or affiliates? If your site truly is the definitive source for information about some topic you're passionate about, then perhaps your affiliates would be willing to include the script on their pages, too; automatically inserting links back to your reference section from their sites. Such a partnership could be beneficial to you as well as your partner's site visitors (and therefore your partners), and may provide you with in-bound links that you would not have otherwise. And partners can include the xref script in their pages the same way you do; i.e., they need only add one line of JavaScript to their pages (which they can probably do through their own CMS), they do not need to replicate a copy of xref on their own sites!

Who Needs xref?

Typical users of xref will be those with pages that deal in some specific way with targeted terms. Reference sites are easy examples, of course; since the terms or topics defined by your reference pages can easily be linked to and provide value-added information to site visitors. But other types of sites might also benefit; such as E-commerce sites (links to products you are selling), or even a site that offers free cooking recipes. Use your imagination! And remember, you can provide the script as a free service to all of your affiliates, as well.

What xref Isn't

Though it provides multiple advantages to Webmasters, xref is not entirely without limitations. Key deficits of xref that you will want to consider before implementing include:

  • As a JavaScript-based tool (even the Perl-based version uses client-side JavaScript to actually insert the links into the page), the links that are created via xref won't be seen by search engine crawlers, and thus those links will not contribute to the search engine placement of your reference pages. But bear in mind--especially in the case of affiliates--xref only provides links that are not already in the page; i.e., its goal is to provide you with links that you didn't have before.

  • With a large number of terms, the size of the script--especially the static JavaScript version--is a definite factor to consider. A prototype I developed for one of my other sites delivers about 32K of script to the browser (and that's with the dynamic version of the script; which delivers a much smaller footprint than the static version). If there's enough interest, I'll work on thinning the initial script footprint in future versions.

As alluded to above, we offer xref in two primary flavors: As a static JavaScript, and in a dynamic, Perl-based version. On the next page, we examine these two versions of the script, including their key differences and potential deployment scenarios.