HTML5 meta Validation

前端 未结 4 2168
孤街浪徒
孤街浪徒 2020-12-16 19:46

Im trying to make my first HTML5 page but i simply cant get it to validate W3C keeps telling me that i have some errors i my meta tags.

the page in question is http:

相关标签:
4条回答
  • 2020-12-16 20:09

    Instead of

    <meta last-modified="Thu, 14 Apr 2011 12:17:27 GMT" />
    

    you need to put

    <meta http-equiv="last-modified" content="Thu, 14 Apr 2011 12:17:27 GMT" />
    
    0 讨论(0)
  • 2020-12-16 20:24

    Have you read the validator message for invalid tags? It says that those tags contain bad values so I'm guessing they are not allowed. Check these links, read validator messages and see if you can find a list of approved tags and properties for HTML 5. Validator services seem to be experimental since HTML 5 is not in it's final form.

    Is the copyright meta tag valid in HTML5?

    http://www.impressivewebs.com/understanding-html5-validation/

    0 讨论(0)
  • 2020-12-16 20:29

    OK, let's take the easy one first:

    <meta last-modified="Thu, 14 Apr 2011 12:17:27 GMT" />
    

    last-modified is not and has never been a valid attribute of the meta element. Not sure what is intended here.

    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    

    Putting caching instructions into meta tags is not a good idea, because although browsers may read them, proxies won't. For that reason, they are invalid and you should send caching instructions as real HTTP headers.

    <meta name="distribution" content="Global" />
    <meta name="copyright" content="(c) 2012 OTUS" />
    

    Neither distribution nor copyright are recognized values for the name attribute of the meta element. Valid names are described at https://w3c.github.io/html/document-metadata.html#standard-metadata-names and http://wiki.whatwg.org/wiki/MetaExtensions.

    I recommend dcterms.audience instead of distribution and dcterms.rights dcterms.rightsHolder instead of copyright.

    0 讨论(0)
  • 2020-12-16 20:32

    This alternative for meta name="last-modifed" is validated by W3 Validator as valid HTML5 and probably recognized by modern search engines:

    <link rel="schema.dcterms" href="http://purl.org/dc/terms/" />
    <meta name="dcterms.modified" content="2018-01-26" />
    
    0 讨论(0)
提交回复
热议问题