Skip to main content
All CollectionsEmbeddingEmbedding your Tolstoy
How to publish stories using code blocks
How to publish stories using code blocks

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 under No app blocks? Use code instead.


Stories code:

<tolstoy-stories

data-tags="{% for tag in product.tags -%}{{ tag }},{%- endfor %}"

class="tolstoy-stories"

data-publish-id="PUBLISH ID"

data-product-id="PRODUCT_ID">

</tolstoy-stories>


6. Paste this code into the Custom liquid section in Shopify.
7. Save your changes.



For Native


1. Go to your Tolstoy dashboard, find the project you want to publish and copy the code provided inside the publish button under No app blocks? Use code instead.


Stories code:

<tolstoy-stories

data-tags="{% for tag in product.tags -%}{{ tag }},{%- endfor %}"

class="tolstoy-stories"

data-publish-id="PUBLISH ID"

data-product-id="PRODUCT_ID">

</tolstoy-stories>

2. Paste the code anywhere into your HTML.

3. Save your changes.





How to find your publish 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.


Need help?

You can reach out to our friendly support team in two ways:

  1. Using our live chat option, which can be found by clicking on the pink chat icon

    on any Tolstoy page in the lower right corner.

Did this answer your question?