Programming SEO – Cross Linking Titles

wood-pigeon

Here is another interesting way to programmatically add link juice to web pages from within your own site.  It will require that you have pages created dynamically from a database and that you have some way of retrieving the title.

You’ll remember that one of the ways of helping a page rank in the search engines is by providing links to that page that say what that page is about.  What better indication of what a page is about than the title?

So what you’ll need to do on each page is to gather a list of all the pages and their titles on your site, search for content on your page that matches each of those titles, and then hyperlink each phrase to the corresponding page on your site.

To do this, I’d recommend using regular expressions.

Given a title of “The Quick Brown Fox” you’d want to find any occurrence of that string that had any number of white space characters between the words and in any mix of casing.

The regular expression for that is:

the\s+quick\s+brown\s+fox

So, for any title, you’d want to initialize your RegEx like this

Regex rx = new Regex(title.ToLower()
    .Replace(" ", @"\s+"),RegexOptions.IgnoreCase);

This assumes that there is only one space between each of the words in your title.

To replace the text in your article with a hyperlink using this text you’d use

body = rx.Replace(body,
    "<a href='locationOfTheArticleHere'>$0</a>");

This technique works best on page titles that are relatively short.  If your titles tend to be longer, as mine do, you might want to provide a list of possible linking phrases for each article.  In that case, I’d link to the titles first and then make a second pass for the linking terms if and only if a title was not found in the article.

The other obvious problem with this technique is that it could take a long time to generate the page if you have a lot of articles and you do this every time the page is displayed.  If this is the case, you’ll want to implement some caching mechanism either by using what is built into .NET or by using some other implementation that caches on a more permanent basis.


Other Related Items:

Belle Memoire Birth Announcements by Helena Seo De...Belle Memoire Birth Announcements by Helena Seo De...Mininum quantity of 25. Designed to showcase the adorable newborn's photo, these birth announcements keeps the birthdate bold yet slightly translucent... Read More >
The Legend of the Shadowless SwordThe Legend of the Shadowless SwordA Wuxia adventure out of South Korea, The Legend of the Shadowless Sword is a handsome martial arts epic by Kim Yung-jun (Flying Warriors). The film's... Read More >
The Art of SEO: Mastering Search Engine Optimization (Theory in Practice)The Art of SEO: Mastering Search Engine Optimization (Theory in Practice)

A well-designed, easy-to-navigate website is useless if no one can find it. If your company is going to succeed in the web economy, optimizing your... Read More >

Related Post

One Response to “Programming SEO – Cross Linking Titles”

DotNetNuke Sponsor

 

Most Valuable Blogger
Sponsor