468,550 Members | 2,392 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Write & Format Meta Tags?

Anybody know how to dynamically write the meta tags using code so they are
formatted on a separate line in the HTML source?
Preferred or optimal framework classes that may be used in this regard?

<meta... />
<meta... />
<meta... />
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
Nov 19 '05 #1
4 2063
not sure but you could try to pass a \n\r at the end of each iteration...

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"clintonG" wrote:
Anybody know how to dynamically write the meta tags using code so they are
formatted on a separate line in the HTML source?
Preferred or optimal framework classes that may be used in this regard?

<meta... />
<meta... />
<meta... />
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

Nov 19 '05 #2
Porbably the easiest way would be to add this in the <head></head>
section:

<asp:Literal runat="server" id="metaPlaceHolder"></asp:Literal>

Then in Page_Load you would iterate through whatever dynamic source you
have for your meta tag info and add the html line by line:

this.metaPlaceHolder.Text = "<meta name=\"keywords\" content=\"one, two,
three\">\n";
-----Original Message-----
From: clintonG [mailto:cs*********@REMOVETHISTEXTmetromilwaukee.co m]
Posted At: Wednesday, August 31, 2005 11:52 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Write & Format Meta Tags?
Subject: Write & Format Meta Tags?
Anybody know how to dynamically write the meta tags using code so they
are formatted on a separate line in the HTML source?
Preferred or optimal framework classes that may be used in this regard?

<meta... />
<meta... />
<meta... />
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
Nov 19 '05 #3
My last was missing something...

Probably the easiest way would be to add this in the <head></head>
section:

<asp:Literal runat="server" id="metaPlaceHolder"></asp:Literal>

Then in Page_Load you would iterate through whatever dynamic source you
have for your meta tag info and add the html line by line:

this.metaPlaceHolder.Text = "<meta name=\"keywords\" content=\"one, two,
three\">\n\t\t";
this.metaPlaceHolder.Text += "<meta name=\"keywords\" content=\"one,
two, three\">";

The /n add the CrLf and the /t/t adds two tabs to line the tags up.

John

-----Original Message-----
From: clintonG [mailto:cs*********@REMOVETHISTEXTmetromilwaukee.co m]
Posted At: Wednesday, August 31, 2005 11:52 AM Posted To:
microsoft.public.dotnet.framework.aspnet
Conversation: Write & Format Meta Tags?
Subject: Write & Format Meta Tags?
Anybody know how to dynamically write the meta tags using code so they
are formatted on a separate line in the HTML source?
Preferred or optimal framework classes that may be used in this regard?

<meta... />
<meta... />
<meta... />
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
Nov 19 '05 #4
Thanks Curt and John. Consider this...

// HtmlMeta Class [1],[2]
HtmlMeta meta = new HtmlMeta();
meta.Attributes.Add("description", "blah blah blah");
HtmlHead head = (HtmlHead)Page.Header;
head.Controls.Add(meta);

But using that class concatentates the text in the HTML source. You'd think
the persons who wrote that class would have at least considered doing it
right because I haven't determined a trick to work-around yet and it looks
like if we want readable results we will have to resort to the use of a
control in the head element.

<%= Clinton Gallagher

[1] http://msdn2.microsoft.com/library/m...us,vs.80).aspx
[2] http://www.howtoadvice.com/SetMetaTags
"John Horst" <jh****@innovasi.com> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl...
My last was missing something...

Probably the easiest way would be to add this in the <head></head>
section:

<asp:Literal runat="server" id="metaPlaceHolder"></asp:Literal>

Then in Page_Load you would iterate through whatever dynamic source you
have for your meta tag info and add the html line by line:

this.metaPlaceHolder.Text = "<meta name=\"keywords\" content=\"one, two,
three\">\n\t\t";
this.metaPlaceHolder.Text += "<meta name=\"keywords\" content=\"one,
two, three\">";

The /n add the CrLf and the /t/t adds two tabs to line the tags up.

John

-----Original Message-----
From: clintonG [mailto:cs*********@REMOVETHISTEXTmetromilwaukee.co m]
Posted At: Wednesday, August 31, 2005 11:52 AM Posted To:
microsoft.public.dotnet.framework.aspnet
Conversation: Write & Format Meta Tags?
Subject: Write & Format Meta Tags?
Anybody know how to dynamically write the meta tags using code so they
are formatted on a separate line in the HTML source?
Preferred or optimal framework classes that may be used in this regard?

<meta... />
<meta... />
<meta... />
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Cezary | last post: by
2 posts views Thread by Donald Firesmith | last post: by
19 posts views Thread by Christian Hvid | last post: by
24 posts views Thread by Day Bird Loft | last post: by
reply views Thread by Phil C. | last post: by
4 posts views Thread by Mark Rae | last post: by
16 posts views Thread by Edward | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.