Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi- I am struggling to determine where I add the widget code for a specific blog post. I need to add a widget for a collaboration, but cannot find the location under "edit code" in our theme. There are numerous locations on the
sidebar but I need to apply it to a blog that is not yet live.
Hi,
- Note the handle of the blog post
- Edit the Blog post template and add conditional statement
Code example
{% if article.handle == 'special-collaboration' %}
<!-- Your Widget Code Here -->
<div class="widget-container">
<!-- Widget code or embed code goes here -->
</div>
{% endif %}
Replace special-collaboration with the handle of blog post and add widget code in the specified section.
Embed the widget code
This was really difficult to understand but I appreciate the reply. Here's what I did: On the toolbar of the blog draft, I selected the </> icon (show HTML) and then pasted the widget code at the end of the content. This worked perfectly.
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025