Search engines optimisation, SEO, is an evolving ‘science’ and it keeps changing on purpose. Most articles that I read which involve both SEO and ASP.NET usually focus on how to programatically set the meta keywords tag and they tend to make it look like very important while, as of today, it has minimal effect on optimisation.
Generally, web developers tend to turn the blind eye when it comes to SEO while a great part of SEO should be done by developers. Here are three rules for .NET developers to follow while building a site:
1 – Favour XHTML with DIV and CSS Design Over Tabular Design
Thankfully, the era of developing tables-based website is about to end. Today most of the sites are following the DIV and CSS style of design and are table free, except for tobular data. However, some designers and developers did not make the leap yet. The DIV with CSS design will:
- Generate less code which will improve your ‘code to content’ ranking which is favoured by search engines.
- Improve your page load as your pages tend to have smaller size with reduced tags and will be even smaller with the CSS sheet separated. Load time is another factor in SEO.
- Promote better web semantics by marking your content with the correct XHTML elements. This will enable the spider(the search engine robot which will crawl your pages content) to better understand the structure of your site and your page content.
Always opt-in for XHTML with DIV and CSS type of design and think of rewriting your current tabular based site in a table-free format.
2 – Allow For Meta Description and Meta Keywords Tags
The meta description tag, from SEO point of view, will suggest to the search engine what to display in the search results page. The meta keywords tags are mostly ignored by search engines as spammers gave them a bad reputation, today they are only used to add misspellings and different culture spellings e.g. ‘optimisation’ and ‘optimization’.
ASP.NET does not provide an out-of-the-box solution in adding these tags, so you have two options:
1- Add a ContentPlaceholder in the head of your MasterPage and fill it with the appropriate MetaKeyword and MetaDescription tags from within the page.In the MasterPage:
In the ASPX Page:
2- Use a base page for your ASP.NET pages (Also known as: Page Controller Enterprise Design Pattern) in which you will create a definition for generating the meta tags. This article Using Meta Tags with Master Pages in ASP.NET is well written and the code is in both C# and VB.NET.
Use a development procedure in adding Meta Description to your site pages where relevant. You could also add a Meta Keywords tag where relevant.
3 – Do Permanent 301 HTTP Redirects to Mark Moved Pages
Usually, when developers change the structure of a website, say upgraded the site from ASP to ASP.NET, they tend to forget that the old pages accumulated SEO ranking over time and it would be unwise to throw that away!
To point the search engine from the old page location to the new page location, you will need to issue a 301 HTTP redirect to the new URL when somebody, including the spider, requests your old page.
301 Redirection in ASP.NET could be done with the following code in the old page’s Init
event:
However, the old page, most probably, will not exist or the old site might be on ASP and ASP is no longer supported on the new site. There is an easy solution for this, try the URL Rewriter Module of IIS. You might also consider implementing your own database driven redirection by using a HttpModule or HttpHandler.
Doing 301 HTTP redirections will maintain the previous ranking that the old URL has accumulated and will update the URL on the search engine result page to the new URL.