How to add multiple tags (article: tag) in Facebook Open Graph?
Asked Answered
E

1

12

For a single blog / article that has multiple tags how would add the Facebook Open Graph data?

This seems like it would be the most logical way to do it. However it reports that it's incorrect in the Facebook debugger:

<meta  property = "article: tag"  content = "advocate, charity, crowdfunding, Healthcare, hospitals, Medical Bills, Medicare, negotiate, uninsured" >

Adding the same above like this seems to be correct, but it seems ridiculous:

<meta property="article:tag" content="advocate" />
<meta property="article:tag" content="charity" />
<meta property="article:tag" content="crowdfunding" />
<meta property="article:tag" content="Healthcare" />
<meta property="article:tag" content="hospitals" />
<meta property="article:tag" content="Medical Bills" />
<meta property="article:tag" content="Medicare" />
<meta property="article:tag" content="negotiate" />
<meta property="article:tag" content="uninsured" />

What is the correct way to do this? Is there a more "optimized" way of writing the above?

Excisable answered 26/3, 2016 at 0:42 Comment(0)
C
14

As specified in the section about arrays (which the article:tag property definition links to), you have to provide multiple meta elements:

If a tag can have multiple values, just put multiple versions of the same <meta> tag on your page.

If using RDFa in the "intended" way, this would be no big issue because you could mark up each tag where it occurs on the page, e.g.

<ul>
  <li property="article:tag">advocate</li>
  <li property="article:tag">charity</li>
  <li property="article:tag">crowdfunding</li>
</ul>

But if you have to provide the elements in the head element, there is no other solution than to add a separate meta element for each tag.

Chromophore answered 26/3, 2016 at 1:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.