Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

H1 tags in the head element - only place developers can use

         

irldonalb

6:13 pm on Jan 12, 2009 (gmt 0)

10+ Year Member



Hi,

I'm working on a complex ecommerce site.

Due to development constraints and complex caching strategies, our H1 tags have to be served in the <head> element.

The developers offered to put them into the source code as hidden divs and then I can move them to the main section using JS.

I'm afraid Google will think this is Black Hat and I'm not sure if I should do it.

Has anyone any advice?

Thanks
Donal

tedster

6:41 pm on Jan 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's not black hat - it's wearing no hat at all. I'd tell the developers to find a way to put the H1 tags within the body section or they will be out of a job. Really.

Wlauzon

6:45 pm on Jan 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Due to development constraints and complex caching strategies, our H1 tags have to be served in the <head> element.

That makes no sense to me at all. Why would the H1 tags be singled out, among all the other tags and CSS?

Do your developers know what they are doing?

pageoneresults

7:16 pm on Jan 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



# Line 34, Column 3: document type does not allow element "h1" here; assuming missing "object" start-tag.
# Error Line 35, Column 6: end tag for "object" omitted, but OMITTAG NO was specified.
</head>
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">"

Do they still issue "Pink Slips"? If not, got some pink paper? Print their notice of termination on it just for the heck of it. ;)

g1smd

9:01 pm on Jan 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's not a developer. That's a Bodger.

Demaestro

9:40 pm on Jan 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Red Flag ¦]
............¦
............¦

[edited by: Demaestro at 9:41 pm (utc) on Jan. 12, 2009]

johnnie

11:18 pm on Jan 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



An H1 can not be present inside the head element. If you want it to be, you dont have a clue about what you're doing. Maybe you're confused with TITLE? That element belongs in the head.

irldonalb

10:06 am on Jan 13, 2009 (gmt 0)

10+ Year Member



It’s a nightmare. The site receives a massive volume of traffic. For this reason different components are cached across multiple templates.

Top Nav is cached on a page level. Left Nav and footer is cached site wide. Putting the information into these will mean the H1 tags won’t be different per page. We’ve 100s of centre templates so to put the logic that creates the tags into these will be extremely difficult and the cost becomes exponential.

Developers have confirmed that the header file includes the opening body tag and our header image. They’ve offered to put the h1 tag in the body and move it to a placeholder when the page loads. It would probably be hidden so the user doesn’t realise we’re moving text. I presume this is equally bad?

Thanks
Donal

Receptional Andy

11:48 am on Jan 13, 2009 (gmt 0)



There's no point whatsoever adding a semantic element like a heading, which is only visible via javascript trickery. The approach misses the point entirely.

At worst, your developers should be advising on how they can fix the inherent problems with your templating/caching system.

Aside from this, why are you going to all this trouble to add a heading? The element in itself is not going to give you much benefit, unless it's part of a well-structured document. It sounds like you're unlikely to have a well-structured document.

Putting the heading within the <body> section is valid, but if it's in the document, why mess around with javascript and placeholders? You could probably put it in place easily enough with pure CSS.

It sounds to me like your developers are working on programming solutions to problems you don't have. They should be working on the wider problems you have with the technology behind your site.

Left Nav and footer is cached site wide. Putting the information into these will mean the H1 tags won’t be different per page.

Obviously we don't know how your site works exactly, but I know many sites that have global templates with things like titles and headings in them. The titles and heading are variables which change depending on which page is being viewed. This is an essential part of most templating systems.

g1smd

7:23 pm on Jan 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't understand how different textual parts of a page can be cached differently.

Images, CSS, JS, etc can each be cached in different ways, but how for the different textual parts?

The site doesn't use frames does it?

Philosopher

7:33 pm on Jan 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ahh...so it sounds as if they aren't putting it in the <head> element, but in a header file...correct? I've seen many such setups where the header file includes the <head> element but also the opening body tag.

As Receptional Andy pointed out, IF this is the case, then it would seem that you should be able to add the H1 directly after the opening body tag then use CSS to position it as you require for each page.

Of course, as other's have mentioned, it sounds as if the backend of the site is somewhat of a mess and you would likely benefit form a redesign (and possibly better developers).

Demaestro

9:10 pm on Jan 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Caching is a great way to help a high traffic site... but a feature like caching shouldn't remove your ability to use other basic features... like having well structured markup and the ability to have unique h1 tags.

You have found yourself waist deep in spaghetti code my friend. When things get like this there comes a point where it is $300 per sq foot to renovate and $100 per sq foot to build brand new.

You should evaluate if you have passed that breaking point.

Sorry because I know this is hardly a solution to your problem but things will only get worse as more code is "hacked" on to make things work as they should have been working the whole time.

Good Luck

[edited by: Demaestro at 9:11 pm (utc) on Jan. 13, 2009]

eltercerhombre

10:29 pm on Jan 13, 2009 (gmt 0)

10+ Year Member



Listen to Philosoper. Probably it's not the header, it's a header file include. This is nothing bad at all.

Finding such a bad developers is not imposible, but pretty difficult (if you do, fire them; if you can't fire them, then your boss knows nothing about the business, fire yourself from there if you can). So probably the second is the case, and they have a communication problem.

irldonalb: tell them to do it in a test server, then check, validate, or do whatever you need to do.

hutcheson

10:56 pm on Jan 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wikipedia has a good article on optimization-for-dummies, with many cautionary epigrams with which (as a professional practitioner) I completely concur. A well-written straightforward algorithm can be analyzed and optimized if necessary: but optimizing a kluge generates something that won't ever be made to work.

An optimized kluge is like a black hole for programming effort: it sucks in minds, souls, and money, and emits lethal radiation.

But you know that, by experience, _now_.