Friday 2 January 2009

Blank <title> tags

If you are using ASP.NET and placehoders to render your metadata. You may notice that it will generate an empty <title> tag. This occurs when using XHTML 1.0 Transitional. I often use placeholders to control the content with in the title tag.

To overcome this, you can add the following in the head tag.

<head>
...
<title visible="false" runat="server"></title>
...
</head>

This turns the <title> tag into a server control, and the visible attribute prevents the blank title from rendering to the page.

No comments: