HTML5 meta Validation
Asked Answered
T

4

10

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://www.jmphoto.dk/otus/index.html (its an old HTML4 page that i try to use as base/redeo as HTML 5)

I cant find anny solution to get the following metatags to validate or find anny substitutes for them that will validate

<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta last-modified="Thu, 14 Apr 2011 12:17:27 GMT" />
<meta name="distribution" content="Global" />
<meta name="copyright" content="(c) 2012 OTUS" />

I have used most of the weekend trying to find a solution on the net but with no luck so I realy hope somebody smart can help me with this.

Trilobite answered 11/3, 2012 at 13:56 Comment(1)
Why do you need any of these? As the other commenters have said most of them are invalid or do nothing or both. Why not just put the copyright statement into a comment and delete all the meta elements, what are the special circumstances about this page that makes you need to try to control the http behaviour from within the page?Shoreline
G
15

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.

Grampus answered 11/3, 2012 at 19:3 Comment(1)
Instead of dcterms.rights, use dcterms.rightsHolder for copyright. See this answer for explanationElga
D
0

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/

Dulse answered 11/3, 2012 at 14:25 Comment(1)
Yes I have read the validator messages but i havent been able to find anny solution to them yet Thanks for the links ... ill take a closer look at themJung
S
0

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" />
Swami answered 25/1, 2018 at 16:22 Comment(0)
Z
-3

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" />
Zahn answered 9/9, 2013 at 13:40 Comment(1)
The OP is trying to get valid HTML5, but if you run a page with your suggested tag through the W3C validator, you will get this message: "Bad value last-modified for attribute http-equiv on element meta."Dimenhydrinate

© 2022 - 2024 — McMap. All rights reserved.