Mobile app version of vmapp.org
Login or Join
Murray155

: Can Open Graph properties be effectively used on tags other than meta/link? meta and link elements sometimes create a sort of redundancy in the markup. For example, there is already a title

@Murray155

Posted in: #Facebook #Html #MetaTags #OpenGraphProtocol #Rdfa

meta and link elements sometimes create a sort of redundancy in the markup. For example, there is already a title element but in order to declare an og:title property one would have to add a separate meta element such as <meta property="og:title" content="Some Title" />. Explicit content of the former and attribute content of the latter are usually the same.

Now, validators will allow you to just do <title property="og:title">Some Title</title> (while it's illegal to also add the content attribute). The question is if this will help Facevook & others do their job. Or maybe even something like <title property="og:title schema:name">Some Title</title>?

A similar thing with og:image - the <meta property="og:image" content="http://example.com/thumbnail.jpg" /> is redundant with the link of the main picture. Is it all right (validators won't object but how about Facebook?) to do <img property="og:image" src="http://example.com/thumbnail.jpg" alt="Some Alt" />?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray155

1 Comments

Sorted by latest first Latest Oldest Best

 

@Shanna517

There are two perspectives:


What is valid RDFa?
What do consumers (like Facebook) support?


The first one can easily be answered by checking the specifications.
The second one depends on each consumer: Is their documentation up-to-date/accurate/complete? How good are their parsers?

For consumers, it would make absolutely no sense to support only a fraction of RDFa. It’s a specification/standard for a reason. They should just use one of the many conforming RDFa parsers and work with the extracted data/triples. When they have this parsed data, then they can decide which vocabularies (like OGP or Schema.org) they support and make use of.

Ideally, they should just state which types/properties (like og:name etc.) and which syntaxes (like RDFa) they support, not just provide "definitions" by showing some markup snippets, where it’s not clear if these are just examples or if they have to be used exactly like that.

So unless their documentation is clear and/or they provide an up-to-date testing tool, you’d have to test it for or ask each consumer you are interested in.

From the HTML5+RDFa perspective …

Using RDFa’s property attribute on the title element is fine:

<title property="og:title">My favorite books - blog.example.com</title>


It’s also allowed to use the content attribute in addition, but it only makes sense if the title you want to use for RDFa is not identical to the user-visible title:

<title property="og:title" content="My favorite books">My favorite books - blog.example.com</title>


Using two or more properties is fine, too:

<title property="og:title schema:name">My favorite books - blog.example.com</title>


And from the RDFa perspective, it doesn’t matter on which element you specify the og:image property, as long as it’s an element that creates a URI as value.

So using

<meta property="og:image" content="http://example.com/thumbnail.jpg" />


is not valid HTML5+RDFa (having Facebook document it like that doesn’t change this fact).

Instead, it could be, for example:

<link property="og:image" href="http://example.com/thumbnail.jpg" />


<img property="og:image" src="http://example.com/thumbnail.jpg" alt="Foo" />

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme