Adding SEO Metadata to Your Theme

You can embed Search Engine Optimization (SEO) metadata in your theme using HTML and Handlebars. Focus on these three key areas:

Add the SEO metadata code inside the <head> section.

For example:

  <head>
<title>
{{page_title}}
{{~#if current_tags}} &ndash; tagged "{{join current_tags ','}}"{{~/if}}
{{~#if current_page != 1}} &ndash; Page {{current_page}}{{~/if}}
{{~#unless page_title contains shop.name)}} &ndash; {{shop.name}}{{~/unless}}
</title>
{{#if page_description}}
<meta name="description" content="{{page_description}}" />
{{/if}}
<link rel="canonical" href="{{canonical_url}}" />
</head>
Note

For another example of adding metadata to a theme, see Seed's implementation.

Title Tag

Add a <title> element so search engines can capture the page title. Most titles can be set in the admin panel, and you can retrieve this title using the Handlebars page_title object.

Meta Description

Add a <meta> element so search engines can read the page description. Most descriptions can be configured in the admin panel, and you can fetch this description using the Handlebars page_description object.

Canonical URLs

Specify the canonical URL for a specific page using the global Handlebars canonical_url object.

Was this article helpful to you?