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

后端 未结 9 1748
有刺的猬
有刺的猬 2020-11-29 06:26

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 abo

相关标签:
9条回答
  • 2020-11-29 06:43

    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

    0 讨论(0)
  • 2020-11-29 06:47

    I would say you to use it. I found meta tags inside body on various webpages, and they are on one of top 10 searches (on google). It shows, at least to me, that searh engines don't mind if you have used this approach.

    You must go ahead if there's no other way around.

    0 讨论(0)
  • 2020-11-29 06:48

    I wouldn't do it. That's not where those tags go, and the search engines might view it as spamming. If you can reorganize the master page you can always add a contentplaceholder up in the head section. I've done it trivially with:

    <asp:ContentPlaceHolder ID="HeadTags" runat="server" />
    

    This way you can add whatever content you like in the head section back on your page:

    <asp:Content ID="Whatever" ContentPlaceHolderID="HeadTags" runat="server" >
    
        <meta ... >
    
    </asp:Content>
    
    0 讨论(0)
  • 2020-11-29 06:51

    Some meta tags that are meant for search engines will not be honored by the search engines in the body section of the page.

    For example Google says that it will not honor a rel=canonical in the body of the page, but only in the head of the page. Here is what Matt Cutts from Google says:

    We don’t allow rel=canonical in the BODY (because as I mentioned, people would spam that),

    0 讨论(0)
  • 2020-11-29 06:52

    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.

    0 讨论(0)
  • 2020-11-29 06:53

    Having the META Description tag in the websites is invalid markup, however is not a huge issue as search engines can regularly find the tag where ever it is. My website does this, have a look at my HTML

    http://cameras.specced.co.uk/compare/268/Canon_EOS_200D

    The META is in the website BODY however it has been indexed by google and the page meta description has been set as the click though text in google search results.

    0 讨论(0)
提交回复
热议问题