How can I load HTML code from a different asset file in liquid?

Hi,

I’m working on my product page liquid and have HTML code that I’d like to “oursource” so that it loads from a different asset file to keep the product page liquid clean. This would be similar to js script assets that can be called. However, I struggle what the syntax is.

I have tried these two, but they dont work:

{{'tabs.html' | file_url }}
{{'tabs.html' | asset_url }}

Could anyone help?

Many thanks!!

Hey,

No, that will not work.

Try this.

Create a snippet called ‘tabs.liquid’, add there your HTML markup.

When you want to use this, include it:

{% include 'tabs' %}

Hope it helps

This worked perfectly! Thanks a lot for the prompt and spot on answer!

I tried copying the code of the HTML file inside the Liquid file but I faced many problems like: SVG causes error, img tag should have width and height, and even more problems I could not find a solution for it

Is there a way to render html file?
and where to move the html file because I tried this and did not work (check picture)
When I move it inside assets folder the app did not refresh and did not show any error