I'm trying to set up OpenGraph tags on a page containing a video. I'm currently setting up the usual sorts of <meta property="og:video"...> tags with calls to drupal_add_html_head(), and that's generally worked fine. The problem is that I'm encoding the video in both .mp4 and .webm formats, so it seems like there should be META tags for both mp4 and webm versions

This is where drupal_add_html_head() seems to break down. I've tried using it to set up both tags but only the last version entered shows up on the page -- the second call seems to be clobbering the first. I've tried assigning different weights to the different elements, but with no success. Any advice out there? Thanks!

  • Are you passing a unique key to drupal_add_html (2nd arg) each time? If so, and it's overriding an existing one with a different key, I think you've found a bug – Clive Jul 29 '14 at 10:37
  • That's the problem, really -- I'm trying to set up several og:video tags on the page, one for each kind of video file held on the page. In looking at the code for drupal_add_html_head(), it appears that the tags are being held in a static array until it's time for them to be put on the page, and so the second call specifying an og:video tag will clobber the first. So I guess it's Behaving As Designed; perhaps the broader question is whether multiple og:video tags is the Right Thing from an OG perspective, which is another matter altogether... – Jim Miller Jul 29 '14 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.