Required Elements In Shopify App?


There are two VERY important elements that must be present in shopify a theme.liquid file. The first is {{ content_for_header }}. This variable must be placed in the head of your theme.liquid. It allows Shopify to insert any necessary code in the document head, such as a script for statistics tracking. For thsoe familiar with WordPress, this is quite similar to the wp_head() function usinging in shopify app.

The other VERY important element is {{ content_for_layout }}. This variable must be placed in the body of your theme.liquid; it’s the place where all of your other Liquid templates will be rendered.
templates folder: This folder holds the rest of your Shopify templates. It consists of:
index.liquid: Displayed as the main index page of your shop.
product.liquid: Each product will use this template to display itself.
cart.liquid: Displays the current user’s shopping cart.
collection.liquid: Displayed for collections of products.
page.liquid: Displayed for any static pages that the shop may have created.
blog.liquid: Displayed for any Shopify blogs for the shop.
article.liquid: Displayed for any blog articles and includes a form for submitting comments.
404.liquid: Displayed for anytime the shop returns a 404.
search.liquid: Displayed for shop search results.

As you might have guessed, each of these templates has access to different variables. For example, product.liquid has access to a product variable which contains the current product being displayed, blog.liquid has access to a blog variable, and index.liquid has access to all of them. If you’re interested in which variables you can use in which template, please review the Liquid documentation.

Advertisements