136

Two common meta element attributes are:

<meta name="" content="">

and

<meta property="" content="">

what is the difference between meta name and meta property?

Cœur
  • 37,241
  • 25
  • 195
  • 267
weaveoftheride
  • 4,092
  • 8
  • 35
  • 53

1 Answers1

120

The name attribute is the "usual" way for specifying metadata in HTML. It’s defined in the HTML5 spec.

The property attribute comes from RDFa.

RDFa 1.1 extends HTML5 so that it’s valid to use meta and link elements in the body, as long as they contain a property attribute.

You can use both ways, HTML5’s name and RDFa’s property, together on the same meta element.

Note that you might also see meta elements with an itemprop attribute. That would be from Microdata.

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
  • Google is giving advice for duplicated meta tags. And its counting the `property="og:dscription"` and `name="description"` attributes as the same – Frondor Jul 25 '14 at 11:02
  • 2
    Is it Frondor's argument true? – Pascut Sep 18 '14 at 11:29
  • @Pascut: Discussing the behaviour of Google’s search engine is off-topic on Stack Overflow. You could create a question on [webmasters.se] asking about it. – unor Sep 18 '14 at 11:34
  • When using the meta viewport tag, please use name instead of property. Property doesn't work in every browser. – Pieter Moeyersons May 03 '16 at 08:32
  • 2
    @PieterMoeyersons: Using `viewport` as value for the `property` attribute would mean something totally different from using it as value for the `name` property; it’s not that some browsers support it like that and some don’t (at least, it should not be), and browsers typically don’t use RDFa anyway (it’s for RDFa parsers, browser add-ons, etc.). – unor May 03 '16 at 12:25
  • 1
    I have noticed that the [linter](https://developers.facebook.com/tools/debug/) ignores `name|value` and `name|content` tags – it only works specifically with `property|content`. – WoodrowShigeru Mar 17 '17 at 12:45
  • Is it good if I include the two attribute? The and – papski Apr 30 '18 at 08:05
  • 5
    @sack: It’s allowed, yes, but if they have the same value, you could also use *one* `meta` element: `` – unor Apr 30 '18 at 18:01
  • @unor Is that why Open Graph protocol used `property` instead of `name`? So we could use both attributes in the same `meta` element? – mrmowji Jan 11 '19 at 22:37
  • @mrmowji: I don’t think that this was the primary reason. They use RDFa most likely because it’s the right tool for the job (providing RDF-based structured data in HTML), and with it comes the feature of re-using existing HTML elements, but that’s not the only feature. – unor Jan 12 '19 at 03:45
  • Giving that these comments report that i.e. viewport should rather use `name`, but other situations even rightout ignore `name`, is there reliable documentation about when to use what attribute? – WoodrowShigeru Aug 09 '20 at 12:33
  • 2
    When I was using only `name="og:image"`, LinkedIn would just get some random image from the page, sometimes even selected an icon. Now that I use both (`name="image" property="og:image"`) it gets the right image. – Shawn May 03 '22 at 16:19