Moodle(安全)内联facebook元数据

My scenario is quite simple, but may hide some critical issues. Let's say I have a student that earned a badge, and wants to share it on facebook. It would be great do that just copy/pasting the badge page url on facebook. But if he does, some metadata are missing on the page (og:image, og:description etc)... quite common. The point is: is there a way to inline some tags in a certain page without hacking the template I am using on Moodle?

Basically I'd just need a place to write some php like:

if (i-am-on-badge-page) 
{
  echo '<medatata ..... />';
}

that should be inlined in the head tag. I know I can do that hacking the theme template files, but that could break updates and drive me crazy if I forget what I hacked in long time.

What's the cleanest way I can do that? Thanks!