Where do I add meta tags for my Shopify Store?

I am using Swiftype’s crawler to index my Shopify store. How do I add meta tags?

Adding meta tags to your Shopify store template allows for greater customization of your search experience. Here’s some pointers on how to access and edit the relevant portions of your Shopify theme template.

Step 1: Open your theme in the Shopify dashboard

Log into your Shopify dashboard and select Online Store → Themes. From this view, select Edit HTML/CSS. This will bring you to a page where you can access the source code for your active Shopify store template.

Step 2: Edit your Layout (theme.liquid)

In the left hand column you will see a list of all the files in your template. Within the Layout folder you should see a file named theme.liquid. This is the base template for your Shopify store. Liquid is a template language that Shopify uses for all pages within a theme.

The theme.liquid will be the main file (if not the only theme file) you’ll need to edit in order to add your custom meta tags.

Step 3: Add meta tags

  • Add your meta tags within the <head> section of theme.liquid file, using Swiftype’s approved syntax like so:
<meta class="swiftype" name="[field name]" data-type="[field type]" content="[field content]" />
Key Field Parameters:
  • name - This parameter value can be anything you would like. Some common examples are fields for product-name, product-description, or price.

  • data-type is the type of content you will be using in the tag. There are several different acceptable data-types and you can see review them by looking at Swiftype’s documentation.

  • content is the actual value (or content) of your custom field. This information can be retrieved using liquid variables. The Shopify Liquid Documentation lists all the variables you can use to access content. There is also an excellent cheat sheet of tags that can be found here.

Examples:

Below are example meta tags on how to dynamically retrieve the title and price values of a product and inject them into the Swiftype meta tag format.

Note: The following examples might need to be edited for your specific theme and site.

  • Product Title
<meta class="swiftype" name="title" data-type="string" content="{{ product.title }}" />
  • Product Price
<meta class="swiftype" name="price" data-type="enum" content="{{ product.price }}" />

Similar syntax and logic can be applied to other template and product variant values that you would like to be indexed by the web crawler.