469,579 Members | 1,112 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

how to add unique meta tags to each content page/

Well its a strange problem i have, some of you might already faced it
and have a solution. I have to maintain a set of unique "search key
words" in meta tags for each content page in my site. With master
paging , i guess i can only have <headtag in my MasterPage. Can any
one let me know how to resovle this issue?

Mar 26 '07 #1
4 2633
add a SearchKeys property to your master page which your other pages can
set and have the master render the proper meta tag.

-- bruce (sqlwork.com)

ba******@gmail.com wrote:
Well its a strange problem i have, some of you might already faced it
and have a solution. I have to maintain a set of unique "search key
words" in meta tags for each content page in my site. With master
paging , i guess i can only have <headtag in my MasterPage. Can any
one let me know how to resovle this issue?
Mar 26 '07 #2
Add using code behind. Page.Header opens up a whole new world when setting
items in the header portion of the master page. :-)

Example for changing title of page (in Page_Load, etc.)

Page.Header.Title = "Some title";

You can also set up meta tags, like so

HtmlMeta metaTag = new HtmlMeta();
metaTag.HttpEquiv = "";
metaTag.Content = "";

Good luck!

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
<ba******@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
Well its a strange problem i have, some of you might already faced it
and have a solution. I have to maintain a set of unique "search key
words" in meta tags for each content page in my site. With master
paging , i guess i can only have <headtag in my MasterPage. Can any
one let me know how to resovle this issue?
Mar 26 '07 #3
ua
I stored the metadata of each file in a database and used the master
record page to add the appropriate scripts to the page like this.

// retrieve and set the metadata
TempDataSetTableAdapters.TWeb_PageMetaDataTableAda pter adpt =
new
TreborSetTableAdapters.TWeb_PageMetaDataTableAdapt er();
TempDataSet.TWeb_PageMetaDataDataTable pmdDT =
adpt.GetPageMetaDataByPageURL(Request.AppRelativeC urrentExecutionFilePath.ToLower());

// if we didn't find a record from the database retrieve the
general one
if (pmdDT.Count <= 0)
{
pmdDT = adpt.GetPageMetaDataByPageURL("general");
}

// if we have a record for meta data, create the tags
if (pmdDT.Count 0)
{
// Render: <meta name="keywords" content="some words" />
HtmlMeta keywords = new HtmlMeta();
keywords.Name = "keywords";
keywords.Content = pmdDT[0].keywords;
this.Page.Header.Controls.Add(keywords);

// Render: <meta name="robots" content="noindex" />
HtmlMeta robots = new HtmlMeta();
robots.Name = "robots";
robots.Content = pmdDT[0].robots;
this.Page.Header.Controls.Add(robots);

// Render: <meta name="description" content="some
description" />
HtmlMeta description = new HtmlMeta();
description.Name = "description";
description.Content = pmdDT[0].description;
this.Page.Header.Controls.Add(description);

// Render: <meta name="date" content="2006-03-25"
scheme="YYYY-MM-DD" />
HtmlMeta date = new HtmlMeta();
date.Name = "date";
date.Content = DateTime.Now.ToString("yyyy-mm-dd");
date.Scheme = "YYYY-MM-DD";
this.Page.Header.Controls.Add(date);
}

Mar 26 '07 #4
You could specify your keyword metatags centrally in your sitemap file.

Then they can be added dynamically as shown in this example:
http://SteveOrr.net/articles/Spiders.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:%2***************@TK2MSFTNGP03.phx.gbl...
Add using code behind. Page.Header opens up a whole new world when setting
items in the header portion of the master page. :-)

Example for changing title of page (in Page_Load, etc.)

Page.Header.Title = "Some title";

You can also set up meta tags, like so

HtmlMeta metaTag = new HtmlMeta();
metaTag.HttpEquiv = "";
metaTag.Content = "";

Good luck!

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
<ba******@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
>Well its a strange problem i have, some of you might already faced it
and have a solution. I have to maintain a set of unique "search key
words" in meta tags for each content page in my site. With master
paging , i guess i can only have <headtag in my MasterPage. Can any
one let me know how to resovle this issue?
Mar 27 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

24 posts views Thread by Day Bird Loft | last post: by
2 posts views Thread by laredotornado | last post: by
1 post views Thread by Eric Levin | last post: by
16 posts views Thread by Edward | last post: by
1 post views Thread by bashetty | last post: by
3 posts views Thread by Jordan S. | last post: by
5 posts views Thread by Candoer | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.