Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if the meta tags are present in the document body?

I am working on a ASP application and the code, template and files are organized in a way that does not allow me to alter anything outside the body tag. So I am thinking about inserting the meta tags inside the body -- like this:

<!-- FEW ASP INCLUDES --> <html>     <head>     <!-- FALLBACK TITLE AND DESCRIPTION -->     <title>Default Title</title>     <meta name="description" content="Default Description"> </head> <body>     <!-- SOME HTML MARKUP -->     <div class="dynamic-content">         <!-- InstanceBeginEditable name="dynamic-content" -->         <!-- THIS IS WHERE I CAN WRITE ASP CODE -->         <title><%= Page.Meta.GetTitle( yada, yada ) %></title>         <meta name="description" content="<%= Page.Meta.GetDescription( yada, yada ) %>">         <!-- InstanceEndEditable -->     </div>     <!-- SOME MORE HTML MARKUP --> </body> </html> 

I am wondering how good it is to put meta tags inside the body of an HTML document. How does it affect:

  1. search engines
  2. browsers
like image 578
Salman A Avatar asked Sep 19 '09 05:09

Salman A


People also ask

What is the purpose of meta tags and what do they contain?

Meta tags are pieces of information you use to tell the search engines and those viewing your site more about your page and the information it contains. Meta tags include: Title tags: the title of your page, which should be unique for every page you publish.

What happens if we don't use meta tag in HTML?

If you don't, when a reader shares your content their post will only include the URL for your article itself, no title, image, or description will appear. Including these tags can drive traffic back to your site and promote your brand.

Why is it a good idea to include meta tags in your HTML document?

Meta tags, or HTML elements, are codes of text that help search engines and website visitors better understand the content found on a website page.

Do I need to put meta tags on every page?

Not All Pages Matter Equally for SEO Don't let your consultant or toolset fool you; you don't need a meta description on every page, or even close to every page. Remember that all content requires future maintenance. It would be far better to have no meta description than a poor or outdated one.


2 Answers

This is of course invalid as per HTML4.01. META tags are only allowed within HEAD (just like, say, TITLE) so by putting it into a BODY, you're essentially creating an invalid markup.

From the cursory tests, it seems that some browsers (e.g. Firefox 3.5 and Safari 4) actually put these elements into HEAD when creating a document tree. This is not very surprising: browsers are known to tolerate and try to interpret all kinds of broken markup.

Having invalid markup is rarely a good idea. Non-standard handling by browsers might lead to various hard-to-pin rendering (and behavioral) inconsistencies. Instead of relying on browser guessing, it's best to follow a standard.

I don't know how search engines react to such tag soup, but I wouldn't risk experimenting to find out :) Perhaps they only parse HEAD tag for certain information and will skip your BODY-contained tags altogether. Or maybe they consider these to be some malicious gambling attempts and black-list pages containing such markup. Who knows.

The bottom line — avoid this whenever possible.

like image 123
kangax Avatar answered Sep 24 '22 04:09

kangax


The bottom line is to avoid this whenever possible when the DOCTYPE forbids it. I think this is definitely permitted in HTML5 and very useful in cases using microdata. Example: http://schema.org/Event

like image 39
Michael H Avatar answered Sep 21 '22 04:09

Michael H