Welcome to WebmasterWorld Guest from 107.20.34.173

Forum Moderators: ocean10000

Message Too Old, No Replies

Query about Labels and H1 Tags in VB.NET

quick question.

     

kolin

4:58 pm on Oct 23, 2006 (gmt 0)

5+ Year Member



i'm trying to get more H1 tags into my website.

i have some ascx code the has a label that was filled with the product name like this:

<asp:label id="ProductName" Runat="server">

I have then stuck it between <h1> tags like so:

<h1 Class="BBProductTitle"><asp:label id="ProductName" Runat="server"></H1>

The source code then shows:

<H1 class="BBProductTitle"><span id="dnn_ctr431_ProductPage_ProductName">Turquoise Tankini</span></h1>

my question is, are search engines picking this up as a H1 tag, and is the span class affecting it in any way?

Thanks

mattglet

5:49 pm on Oct 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't have an answer to your SE question, but if you're absolutely worried about it you change the Label to a Literal and have this as your product name (in your code-behind):

ProductName.Text = "<h1 Class=""BBProductTitle"">" & ProductNameVariable & "</h1>"

sharbel

12:36 am on Oct 24, 2006 (gmt 0)

10+ Year Member



Like the above poster, i am not 100% sure it matter either, however you *are* using the wrong server control IMHO. A Label inherits from WebControl so that you have all the styling and formatting options that WebControl offers (bleh). Your situation is better served with a Literal control which inherits from Control (lighter weight with none of the fancy (and useless) styling options of WebControl. Moreover, Literal controls do not wrap the Text property in a Span the way a Label does...

Easy_Coder

12:45 am on Oct 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why not just do this?

<h1 Class="BBProductTitle" Runat="Server"></H1>

kolin

10:11 am on Oct 24, 2006 (gmt 0)

5+ Year Member



i'm editting the source code of an existing VB.Net implemented E-Commerce software, in order to customise it, so i'm trying to remove a lot of the 'Shrapnel' that appears, as well as code in some SEO techniques that i feel need to be in there.

I would replace with a literal, but i don't really have the time at this point to try and sift through all the code to find where the text value is pulled from.

venton

4:00 pm on Oct 24, 2006 (gmt 0)

5+ Year Member



You could put the <H1> and </H1> tag into the text of the label itself.

It would render as

<span id="dnn_ctr431_ProductPage_ProductName"><h1 class="BBProductTitle">Turquoise Tankini<h1>/span>

This would be better for seo IMO

Jimmy Turnip

11:55 am on Oct 26, 2006 (gmt 0)

10+ Year Member



venton:
I don't think <span id="dnn_ctr431_ProductPage_ProductName"><h1 class="BBProductTitle">Turquoise Tankini<h1>/span> is valid markup - you shouldn't wrap a block level element (<h1>) in an inline element (<span>).

A literal would be a better idea. You should only have to change the definition in the code.

[edited by: Jimmy_Turnip at 11:56 am (utc) on Oct. 26, 2006]

Easy_Coder

12:21 am on Oct 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I still don't understand why you just don't run the H1 tag at the server and ditch the span all together. You can fix this in no time at all.

carguy84

6:19 am on Oct 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Second what Easy_Coder said, but regardless, just use this:

<h1 Class="BBProductTitle"><asp:literal id="ProductName" Runat="server"></H1>

Easy_Coder

7:08 pm on Oct 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The span is the result of a label control on the front end, so once you adjust the h1 or use the literal (either way)... then just ditch the Label Control.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month