How can I successfully insert liquid code into page content on Shopify?

I’m two weeks into learning about Shopify, liquid, and theme modification. Using the theme called ‘Supply’. I added a new page for vendors. In the page content area, you can see I added vendor images (photo#1) and then I chose to add to the page content (toggle view into html mode, photo#2) and added basically the same html this theme uses to format collections (section/collection-template and snippets/product-grid) to format my vendor logos. I wanted to make each logo clickable and so I anchored each logo, but here is where I want to anchor links to be dynamic and tried to inject liquid code inside of the anchor’s href=“{{shop.domain}}”, but it appears that this doesn’t work. Is injecting liquid code into page content so different than what we do when we inject liquid into templates, sections, or snippets? I guess the answer is yes, as it doesn’t work. So what are my alternatives here?

2 Likes

Unfortunately, you’re right in your prediction that this is not possible - any content added in the rich text editor is rendered as HTML. Even Liquid code itself.

2 Likes

Did you find a satisfactory answer to this question? I too am new the shopify world. I’m trying to create a form that allows a logged in customer to create a message card. I need to either create a page with a form or bury a form into a product page (the preferred solution). I’m looking more deeply into this article https://www.shopify.com/partners/blog/88186566-tips-for-using-snippets-in-your-shopify-theme but I dislike having to edit the product.liquid (or in your case page.liquid) code of the theme.

Did this feature get implanted of is there a work around?

I was looking into liquid code in pages too, which is how I got here! :slightly_smiling_face:

There’s one alternative with Shopify 2.0 themes - you can always create a separate page template for your vendors page, and then use all kinds of sections in the page template. The sections also include “Custom Liquid” ones that can hold any HTML with liquid code.

It looks like the Supply theme is a vintage one (i.e. pre-Shopify2.0 theme), which doesn’t have sections support for all pages (only the main page).

Hope that helps! That’s the alternative way I’m going to use - use a separate page template and use sections, instead of using the page editor directly, which in any case seems to be very limited in scope unfortunately. Hopefully they’ll add support for more rich editing, including liquid code in pages

Cheers,

Sridhar