You can include search engine optimization (SEO) metadata in your theme using HTML and Liquid. There are three main aspects to consider:

The code for the above SEO metadata should be included in the <head> element.

For example:

<head>
  <title>{{ page_title | default: shop.name }}</title>
  <meta name="description" content="{{ page_description | default: shop.name | escape | truncatebytes: 320, "" }}">
  <link rel="canonical" href="{{ canonical_url }}">
</head>

The title tag

You can include a <title> element for search engines to read the page title from. The title for most pages can be set in the admin, and you can access this title with the Liquid page_title object.

The meta description

You can include a <meta> element for search engines to read the page description from. The description for most pages can be set in the admin, and you can access this description with the Liquid page_description object.

Canonical URLs

You can specify a canonical URL for a given page using the global Liquid canonical_url object.