Home > Archive > ASP .NET > August 2005 > Re: Write & Format Meta Tags? - Reposted
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Write & Format Meta Tags? - Reposted
|
|
| John Horst 2005-08-31, 6:59 pm |
| 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:csgallagher@REMOVETHISTEXTmetrom
ilwaukee.com]
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/
| |
| clintonG 2005-08-31, 6:59 pm |
| 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/ms154704(en-us,vs.80).aspx
[2] http://www.howtoadvice.com/SetMetaTags
"John Horst" <jhorst@innovasi.com> wrote in message
news:eJ4WDcnrFHA.2064@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:csgallagher@REMOVETHISTEXTmetrom
ilwaukee.com]
> 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/
>
>
|
|
|
|
|