|
Thursday, May 10, 2007 |
| Setting meta tags for content pages in ASP.NET 2.0 |
|
I replied to a post in the forums regarding how to set meta tags for each content page in an app. If you set the meta tags in the master page, all your pages will have the same meta tags. One way to accomplish setting the meta tags for each content page is to use code like the following.
Dim metaTag As New HtmlMeta Dim HeadTag As HtmlHead = CType(Page.Header, HtmlHead) metaTag.Attributes.Add("name", "description") metaTag.Attributes.Add("content", "your description goes here") HeadTag.Controls.Add(metaTag) metaTag = New HtmlMeta metaTag.Attributes.Add("name", "keywords") metaTag.Attributes.Add("content", "your keyword go here") HeadTag.Controls.Add(metaTag)
This code could also be used to dynamically add meta tags to your pages. The tag values could be stored in a database, and then retrieved and plugged into the code. |
jeremy at 4:41 PM |
(9) Comments |
Add a comment |
Permalink
|
|
|
|