4

As far as I can tell, property is not a valid attribute of the <meta> tag in any of HTML 3, 4, XHTML-Transitional or XHTML-Strict. So why does the Open Graph Protocol (and Facebook's API docs) specify example code like this?

<html xmlns:og="http://ogp.me/ns#"> <head> <title>The Rock (1996)</title> <meta property="og:title" content="The Rock" /> <meta property="og:type" content="movie" /> <meta property="og:url" content="http://www.imdb.com/title/tt0117500/" /> <meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" /> 

This doesn't validate. Changing property to name does validate, and I can verify that, at least on Facebook, it still works as intended. So why do they use property in their example code?

http://opengraphprotocol.org/

1 Answer 1

0

They define their own custom DTD (definition of DTD). This allows them to create their own extension to the HTML standard and as long as they follow their own DTD they are technically ok. It won't be valid HTML but it doesn't have to be.

4
  • 2
    Why not? How hard would it have been to do it right? Commented Sep 16, 2010 at 8:38
  • Does it have to be pure HTML to be right? Commented Sep 17, 2010 at 11:53
  • 1
    Just because they can, doesn't mean they should. The answer doesn't clarify why they did that in the first place. Why didn't they use name instead of property? Was it necessary? Commented Jan 11, 2019 at 22:26
  • Necro bump! Here's the spec for OG: ogp.me "The RDF schema (in Turtle) can be found at ogp.me/ns." HTLM5 validation: stackoverflow.com/a/25575860/2586761 Commented May 25, 2022 at 6:13

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.