This project is read-only.

Page Title

Topics: ASP.NET 2.0
Oct 19, 2009 at 1:04 AM

How do I change the page title?

Normally I can add Title="MyBlog | Archive" to the page directive, but adding a title attribute does not change the page title.

However, the login page does use a title attribute. What is diffrent about the login page?

--- Ryan

Oct 19, 2009 at 2:07 AM

The title of your page comes from the title of your post. The reason why the login page can be set is because it is an actual physical page whereas posts and pages created are not.

Oct 19, 2009 at 3:47 PM

That makes sense, however, the pages I want to change are the default.aspx and archive.aspx.  Both of those are actual physical pages as well? How do I change their title? Where is their title set?

--- Ryan

Oct 20, 2009 at 12:38 AM

You can basically change the title for every page.

For default.aspx and archive.aspx, search inside the code behind files for these pages -- default.aspx.cs and archive.aspx.cs.  You'll find in there Page.Title = .....  You can change it to what you'd like.  The default.aspx.cs actually has "Page.Title =..." in there several times depending on what type of posts are being displayed.

You can also change the title for your pages.  In the page.aspx.cs file, in AddMetaTags(), the title is being set:

base.Title = Server.HtmlEncode(Page.Title);

You can change that to something different ....

base.Title = "some other title";