473,419 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Dynamic Generation of Meta Tags

Hi:

I'm developing a new C# Web App and I'm hoping to find a way that I can
dynamically generate meta tags for the search engines at the page level.
(I want to do this so that I can have someone update a database with the
appropriate tags - since we cache our pages this won't be a performance
problem).

I am using a master pages so I will need a way to update each page that
we decide should have tags.

I have not been able to locate any info on how to do this. If anyone
can point me in the right direction it will make my day!

Thanks,

Fred
Dec 1 '05 #1
6 4728
Fred,

You should be able to specify a content provider (just like you do in
the master page for the content that is page-specific).

In your individual page, you should be able to reference that content
provider, and set the content of it to be whatever you want.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:et**************@TK2MSFTNGP12.phx.gbl...
Hi:

I'm developing a new C# Web App and I'm hoping to find a way that I can
dynamically generate meta tags for the search engines at the page level.
(I want to do this so that I can have someone update a database with the
appropriate tags - since we cache our pages this won't be a performance
problem).

I am using a master pages so I will need a way to update each page that
we decide should have tags.

I have not been able to locate any info on how to do this. If anyone
can point me in the right direction it will make my day!

Thanks,

Fred

Dec 1 '05 #2
Nicholas:

Thanks for your reply!

I'm a little confused so let me explain. I can build the info for the
meta tags from a database (probably a class library that accesses the db
and prepares the tags).

I don't know how to actually write the meta tags in the header of the
pages.

For example:

<head>
<title>This is my page</title> // comes from title prop of page
<meta name="KEYWORDS" content="this is my content">
</head>

If you have any suggestions I would greatly appreciate them!

Thanks again,

Fred
Nicholas Paldino [.NET/C# MVP] wrote:
Fred,

You should be able to specify a content provider (just like you do in
the master page for the content that is page-specific).

In your individual page, you should be able to reference that content
provider, and set the content of it to be whatever you want.

Hope this helps.


Dec 1 '05 #3
Fred,

That's simple, wouldn't you just do this:

<head>
<title>This is my page</title> // comes from title prop of page
<%
// Get your database stuff here.

// Start cycling through rows.
foreach (DataRow row in rows)
{
// Write the content.
%>
<meta name="<% =row["name"] %>" content="<% = row["content"] %>">
}
%>
</head>
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:uY**************@TK2MSFTNGP10.phx.gbl...
Nicholas:

Thanks for your reply!

I'm a little confused so let me explain. I can build the info for the
meta tags from a database (probably a class library that accesses the db
and prepares the tags).

I don't know how to actually write the meta tags in the header of the
pages.

For example:

<head>
<title>This is my page</title> // comes from title prop of page
<meta name="KEYWORDS" content="this is my content">
</head>

If you have any suggestions I would greatly appreciate them!

Thanks again,

Fred
Nicholas Paldino [.NET/C# MVP] wrote:
Fred,

You should be able to specify a content provider (just like you do in
the master page for the content that is page-specific).

In your individual page, you should be able to reference that content
provider, and set the content of it to be whatever you want.

Hope this helps.

Dec 1 '05 #4
Hi Nicholas:

I get the feeling that we are VERY close to solving this.

My question comes down to how would I specify and then write to the area
within the <% and %> - how would I create and reference this.

I'm hoping that this is a "newby" question!

Thanks again!

Fred
Nicholas Paldino [.NET/C# MVP] wrote:
Fred,

That's simple, wouldn't you just do this:

<head>
<title>This is my page</title> // comes from title prop of page
<%
// Get your database stuff here.

// Start cycling through rows.
foreach (DataRow row in rows)
{
// Write the content.
%>
<meta name="<% =row["name"] %>" content="<% = row["content"] %>">
}
%>
</head>


Dec 1 '05 #5
2.0 has new classes...

// Add meta tags
HtmlMeta meta1 = new HtmlMeta();
meta1.Attributes.Add("description", "blah blah blah");
HtmlHead head = (HtmlHead)Page.Header;
head.Controls.Add(meta1);
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
"Fred Nelson" <fr**@smartybird.com> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
Hi Nicholas:

I get the feeling that we are VERY close to solving this.

My question comes down to how would I specify and then write to the area
within the <% and %> - how would I create and reference this.

I'm hoping that this is a "newby" question!

Thanks again!

Fred
Nicholas Paldino [.NET/C# MVP] wrote:
Fred,

That's simple, wouldn't you just do this:

<head>
<title>This is my page</title> // comes from title prop of page
<%
// Get your database stuff here.

// Start cycling through rows.
foreach (DataRow row in rows)
{
// Write the content.
%>
<meta name="<% =row["name"] %>" content="<% = row["content"] %>">
}
%>
</head>

Dec 2 '05 #6
Clinton:

Thanks very much for the help - it looks like this will work for me!

Fred

clintonG wrote:
2.0 has new classes...

// Add meta tags
HtmlMeta meta1 = new HtmlMeta();
meta1.Attributes.Add("description", "blah blah blah");
HtmlHead head = (HtmlHead)Page.Header;
head.Controls.Add(meta1);
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
"Fred Nelson" <fr**@smartybird.com> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
Hi Nicholas:

I get the feeling that we are VERY close to solving this.

My question comes down to how would I specify and then write to the area
within the <% and %> - how would I create and reference this.

I'm hoping that this is a "newby" question!

Thanks again!

Fred
Nicholas Paldino [.NET/C# MVP] wrote:
Fred,

That's simple, wouldn't you just do this:

<head>
<title>This is my page</title> // comes from title prop of page
<%
// Get your database stuff here.

// Start cycling through rows.
foreach (DataRow row in rows)
{
// Write the content.
%>
<meta name="<% =row["name"] %>" content="<% = row["content"] %>">
}
%>
</head>



Dec 2 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
4
by: Tim::.. | last post by:
Can someone please tell me why the following dynamic refresh doesn't work! Thanks Inline code... <!----- dynamically filled META REFRESH element -----> <meta id="mtaRefresh" runat="server" />...
10
by: Ognen Duzlevski | last post by:
Hi, I have a "language definition" file, something along the lines of: page :: name : simple caption : simple function : complex function :: name : simple code : simple
2
by: Dst | last post by:
<head runat="server"> <noscript> <meta http-equiv='refresh' content='0;url=Unsupported.htm'/> </noscript> </head> If i add this to my webform, it redirects to Unsupported.htm if javascript...
16
by: Edward | last post by:
Hi All, I am having huge problems with a very simple dotnet framework web page (www.gbab.net/ztest3.aspx) , it does NOT render correctly under Apple's Safari. The DIV's do not align amd float as...
2
by: thetechturf.com | last post by:
I have some simple dynamic content pages (included below). I need to know how to add specific meta tags (ie. description, keywords, ect.), as well as extra specific header coding to a page. I would...
21
by: karen987 | last post by:
I have a news website, with asp pages. It has publishing software which allows you to add articles in a database, and then calls them up from links etc. I have added dynamic meta tags in 2 parts. The...
5
by: Nick | last post by:
Hi there, I am adding a meta redirect tag to the page dynamically on 2 separate pages in asp.net. One of the pages it works fine, and 5 seconds after the page appears, the redirect occurs. On...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.