Search code examples
facebook-likemeteoraddthis

How can I add xmlns namespace to <html> tag in meteor


This is what I'm trying to accomplish (to integrate Facebook send button using addthis)

<html xmlns:fb="http://ogp.me/ns/fb#">

However the html is out of my control. Meteor also forbids adding attributes to <head> such as:

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">

Workarounds that serve the same purpose are more than welcome.


Solution

  • I'm not sure how to change it through the raw source. But you can use something in your rendered callback to get to it via:

    Template.hello.rendered = function() {
        $('html').attr("xmlns:fb","http://ogp.me/ns/fb#");
        $("head").attr("prefix", "og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#");
    }
    

    This uses JQuery to modify the html tag as soon as Meteor renders the DOM.