Magento 1.8 – Using instafeed.js in Static Block

cmscms-blockjavascriptlayoutmagento-1.8

I tried using instafeed.js from http://instafeedjs.com/ to show an instagram feed using a particular hashtag right before the footer on my homepage.

I added the file instafeed.min.js to my default/theme/js

I created a static block called instafeed with the content

<script type="text/javascript">
    var feed = new Instafeed({
        get: 'tagged',
        tagName: 'awesome',
        clientId: 'my client ID'
    });
    feed.run();
</script>

Then to the homepage layout xml I added

<block type="cms/block" name="instagram" after="previous block's name">
<action method="setBlockId"><block_id>instafeed</block_id></action>
</block>

Is this the correct way to integrate?

Best Answer

Is this the correct way to integrate?

Yes.

To clarify, you are using the right method because the script is only used on one page. If you wanted it to be included with every page then you could use the setting System > Configuration > Design > Footer > Miscellaneous HTML instead.

Related Topic