Hochman Consultants - Results Driven Internet Marketing
Client Login

ASP.NET SEO: How to Create Custom Titles and Meta Descriptions

Search engines use page titles as one of the strongest signals for classifying and ranking pages. Meta descriptions often appear as the search listing's snippet so you want them to be catchy, informative and specific to each page in order to encourage more users to select your listing. If you have a website with many ASP.NET pages generated dynamically, such as a product catalog, it would be a lot of work to add a custom title and meta description to each page by hand.

Rather than hand coding, it is often possible to use data that's already available within the web application to set the titles and descriptions. In ASP.NET, this programming can be a bit tricky. Here's some sample code from a project I did.

Product.aspx

<!-- Replace lblProductTitle with the name of the variable that contains your product title.
Make sure the value is set in the code behind page. -->

<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=lblProductTitle.Text%> &raquo; Test.com</title>
<meta name="description" content="Get widgets: low prices and free 
shipping at Test.com" runat="server" id="description" />

Product.aspx.vb

'Make sure this import statement appears at the top of the page.
Imports System.Web.UI.HtmlControls

'Put this code in DataBind() or some other subroutine that runs on page load. 'Replace lblProductTitle with the variable containing your product title. description.Attributes("content") = " Get widgets: low prices and free shipping at Test.com. " & lblProductTitle.Text & "available for less."

About the Author

After graduating from Yale with two degrees in Computer Science, Jonathan Hochman set up his own consulting company in 1990. He has been an Internet marketer since 1994. To send feedback, please visit http://www.hochmanconsultants.com/.

Creative Commons License You may distribute this article in its entirety under a Creative Commons Attribution 3.0 License. Please attribute the author by name and link (URL).

For additional information, please contact Hochman Consultants.