SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Are My Meta Tags Up-to-date with HTML5 standards?

    Searched around, and have been reading different answers about this topic, so I figured I would post it here and see what you guys think...

    Here's the current Meta Tags I use for Html5...

    <head>
    <title></title>
    <meta charset="utf-8">
    <meta name="description" content="">
    <meta name="robots" content="all">
    </head>

    Am I missing anything? If you guys could post the code you use on this topic, that would be great! Thanks!

  2. #2
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,273
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    As best as I can tell, the only meta tag difference between HTML4 and HTML5 is the new "charset" attribute, which is just a shorthand for http-equiv="Content-Type" content="text/html; charset=UTF8".

    Though, I'd suggest you move the charset meta above the title, otherwise the title won't be able to use the full range of characters.
    "First make it work. Then make it better."

  3. #3
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jeff Mott View Post
    As best as I can tell, the only meta tag difference between HTML4 and HTML5 is the new "charset" attribute,
    There are more differences.

    Quote Originally Posted by Jeff Mott View Post
    Though, I'd suggest you move the charset meta above the title, otherwise the title won't be able to use the full range of characters.
    Not correct. It needs to be within the first 1024 bytes, though.
    Simon Pieters

  4. #4
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ScotchTape88 View Post
    <meta name="description" content="">
    If you're going to have it empty, you can omit the whole thing.
    Quote Originally Posted by ScotchTape88 View Post
    <meta name="robots" content="all">
    This can also be omitted.
    Simon Pieters

  5. #5
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,273
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zcorpan View Post
    Quote Originally Posted by Jeff Mott
    Though, I'd suggest you move the charset meta above the title, otherwise the title won't be able to use the full range of characters.
    Not correct. It needs to be within the first 1024 bytes, though.
    Hmm... I really thought I had seen a situation where this was the case, but now I can't reproduce it. So it seems you're correct. My mistake.

    Quote Originally Posted by zcorpan View Post
    There are more differences.
    I guess I'm behind the curve then. What other meta tag differences are there in HTML5?
    "First make it work. Then make it better."

  6. #6
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Though really it still should come before the TITLE if you are using that element for such propose that's probably where the other confusion occurred.

  7. #7
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jeff Mott View Post
    I guess I'm behind the curve then. What other meta tag differences are there in HTML5?
    Well let's see.

    global attributes: HTML4 allows lang and dir, HTML5 allows global attributes on all HTML elements.

    http-equiv: HTML4 says this attribute is for *servers*, HTML5 says it's for UAs. HTML4 allows any HTTP header, HTML5 has a small set of allowed values.

    name: HTML4 "does not list legal values for this attribute.", HTML5 lists legal values and has a wiki page as extension point.

    scheme: obsolete in HTML5.

    New element-specific attributes in HTML5: charset.

    Global attributes in HTML5 other than link and dir:
    accesskey
    class
    contenteditable
    contextmenu
    draggable
    dropzone
    hidden
    id
    inert
    itemid
    itemprop
    itemref
    itemscope
    itemtype
    spellcheck
    style
    tabindex
    title
    translate
    event handler attributes
    data-* attributes
    ARIA attributes

    content model: HTML4 allows only in head, HTML5 allows in body when microdata attributes are used, and in noscript in head (depending on the attributes).

    required attributes: HTML4 has all attributes except content optional, and content required. HTML5 says "Exactly one of the name, http-equiv, charset, and itemprop attributes must be specified. If either name, http-equiv, or itemprop is specified, then the content attribute must also be specified. Otherwise, it must be omitted."

    Well that's just scratching the surface, if you check the definition of each name and http-equiv keyword in HTML4 and HTML5 you'll likely find that every one of them is changed in some way (probably because HTML4 is so handwavy).
    Simon Pieters

  8. #8
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xhtmlcoder View Post
    Though really it still should come before the TITLE
    There's no such requirement in the spec.

    Why not? Doesn't the browser need to know the encoding before it can decode the title? Yes, it does, but the charset meta is scanned for in the first 1024 bytes before the real HTML parser starts. (The HTML parser also looks for charset metas if the scanner failed to find one, but this can cause the page to be renavigated and scripts to execute twice so it's a bad idea to rely on it and it's invalid).

    I'd say it's a good idea to declare the encoding in the HTTP header so the scanner can be skipped altogether.
    Simon Pieters

  9. #9
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    I didn't mean a 'requirement', it never has been to my knowledge? I agree it's a lot lower down the food chain order than HTTP Content-Type header; etc; if available.

  10. #10
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, OK. It was a requirement early on in HTML5 actually, before the parser and pre-scanner was fully fleshed out.
    Simon Pieters

  11. #11
    SitePoint Enthusiast polyhedra's Avatar
    Join Date
    Nov 2011
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Though, I'd suggest you move the charset meta above the title, otherwise the title won't be able to use the full range of characters.
    What is the reason for having the <meta> tags before the <title> what does it give me? I do it in my documents but i am not clear as to why.

  12. #12
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,888
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by polyhedra View Post
    What is the reason for having the <meta> tags before the <title> what does it give me? I do it in my documents but i am not clear as to why.
    By default, you can only use ASCII characters unless you have declared a different character set. That takes effect from the point where you make the declaration. So anything you have before the <meta charset> must be in ASCII or use HTML entities for any non-ASCII characters.

  13. #13
    SitePoint Enthusiast polyhedra's Avatar
    Join Date
    Nov 2011
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okey it's thing so text can be display properly in the english alphabet. Here is a good example. How about the other character set's out on the net?

  14. #14
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,200
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by polyhedra View Post
    okey it's thing so text can be display properly in the english alphabet. Here is a good example. How about the other character set's out on the net?
    It's not really clear what your question is. You can use UTF-8 to cover most (if not all) languages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •