Skip to main content

How to publish stories using code blocks in Tolstoy platform

Publishing stories via code

Mikaela Lasig avatar
Written by Mikaela Lasig
Updated over a week ago

For Shopify V1


1. Log into your Shopify admin.
2. Go to the page where you want to add the block.
3. Click on the page editor.
4. Add a Custom Liquid section where you want the block to appear.
5. Go to your Tolstoy dashboard, find the project you want to publish and copy the code provided inside the publish button

Steps:

1. Click Publish

2. Click No app blocks? use code instead

3. Copy the code, then click done


Stories code:

<tolstoy-stories
data-tags="{% for tag in product.tags -%}{{ tag | escape }},{%- endfor %}"
class="tolstoy-stories"
data-publish-id="YOUR PUBLISH ID"
data-product-id="{{ product.id }}">
</tolstoy-stories>

4. Paste this code into the Custom liquid section in Shopify.
5. Save your changes.


For Native Website

Steps:

1. Click Publish

2. Click No app blocks? use code instead

3. Copy the code, then click done


Stories code:

<tolstoy-stories
data-tags="{% for tag in product.tags -%}{{ tag | escape }},{%- endfor %}"
class="tolstoy-stories"
data-publish-id="YOUR PUBLISH ID"
data-product-id="{{ product.id }}">
</tolstoy-stories>

4. Paste the code anywhere into your HTML.

5. Save your changes.


How to find your product ID


For Shopify

  1. Go to your Shopify Admin dashboard.

  2. Click on Products to view your product list.

  3. Click on the product you want to link.

  4. In the URL of your browser while viewing the product, the number at the end after /products/ is the product ID.

For Other Platforms/ Native websites

The method is similar: look for the product in your platform's product management section and use the unique identifier given in the URL or product details section. Usually, this can be found on your website.

Did this answer your question?