The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Dynamically creating the TITLE tag

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Michael Mello

Posts: 100
Nickname: knarf
Registered: May, 2004

Michael Mello is .NET Web Developer
Dynamically creating the TITLE tag Posted: May 4, 2004 4:12 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Michael Mello.
Original Post: Dynamically creating the TITLE tag
Feed Title: melloblog
Feed URL: http://www.thauvin.net/errorpage.htm?aspxerrorpath=/Default.aspx
Feed Description: .NET and Everything After.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Michael Mello
Latest Posts From melloblog

Advertisement
Every now and then I'll enter some search criteria into Google, and see how some of my pages rank.  Lately I've noticed that the searches that return the title links to the feedback of my blogs, don't look so hot.

For example, if you were to type in 'isnumeric in C#' into a Google search, as of this moment, Google will return a link to my post in the second page, which looks like this:

Melloblog - Feedback About Blogs Posted.

Now there is nothing wrong with the way Google is returning the search results, but there is something wrong with my title.  It's not very elegant, and could be more descriptive.

Dynamic Title

My answer is to utilize 'runat="server"' within my title tag, to create a dynamic title, based on the blog entry.


<!--Here is the title tag in my html file-->
<title id="PageTitle" runat="server"><title>



Now I can programmatically access the title tag in my codebehind.


//declare the title control
protected System.Web.UI.HtmlControls.HtmlGenericControl PageTitle;

//make the title of the page, the title of the blog
PageTitle.InnerHtml = "Melloblog - " + myBlogs.GetBlogTitle(BlogID);



The 'myBlogs.GetBlogTitle(BlogID)', is simply the method of my class that will return the title of the current blog.  If all goes as planned, my search results that point to the feedback pages will return this instead:

Melloblog - IsNumeric in C#

A lot more descriptive, and more likely to be explored by the end user.  Stay tuned...

Read: Dynamically creating the TITLE tag

Topic: Devscovery in Review: another perspective Previous Topic   Next Topic Topic: Version 2.0 of the .NET Compact Framework standalone!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use