Skip to main content
Astro changes <script> tags when it builds your site, and the widget does not show. Add is:inline to the script tag to stop that. The same steps work for Facebook, X, TikTok, YouTube and review widgets.

In SnapWidget

  1. Create your widget, or open an existing widget from your dashboard.
  2. Click Install Widget.
  3. In the Install Widget window, click Copy Code.

Find your widget ID

Look at the code that you copied. Your widget ID is the value of data-widget-id. If your code has an <iframe>, your widget ID is the part of the address after /embed/. For a review widget, your widget ID is the value of data-reviews-id, or the part of the address after /embed/reviews/.
These steps are for feed, grid and review widgets. They are not for popup and banner widgets.

In your Astro project

Add this code to the page or component where you want the widget to show, for example src/pages/index.astro:
If your code has a line that starts with <div class="snapwidget-embed", use that line in place of the <div> above. It has the size of your widget. For a review widget, use data-reviews-id in place of data-widget-id. If your code has lines with snapwidget-lightbox, your posts open in a pop-up. Add these lines too:

Check your widget

Open the page in your browser. The widget shows your latest Instagram posts. If the widget is too narrow or too wide, give the element around the widget a width, for example width: 100%.