Search code examples
vue.jsinstagram

How to manually embed an Instagram post in vue.js in 2021


I want to insert the publicly available embed code, provided by Instagram for one post, into my vue.js app. Instagram provides an embed snippet for any post in the 3 dots at the top right of any Instagram post.

If I paste this in my Vue template I get this error:

"Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as , as they will not be parsed."

What does this mean and how can I get round it in Vue?

I have looked at several npm packages for embedding Instagram posts in Vue, but they all appear to have stopped working with Instagram's new nightmare authentication process. If I paste this into a vanilla html page (without Vue) it works fine.

I am using Gridsome with Vuetify.


Solution

  • Remove <script from embed code and import it in this way https://gridsome.org/docs/head/