Manage SEO data with the Admin API

You can change the way a product, page, collection, blog, or article appears in search engines by updating the resource's SEO data. This can be done by creating or updating metafields.

Update a resource's search engine listing

To change a resource's search engine listing, you can update two different metafields, title_tag and description_tag. These metafields exist in a namepsace called global. By updating the values of these metafields, you can change the title and description for a resource's search engine listing.

Example JSON request

This request would be used to change the description for a product's search engine listing: POST /admin/api/2021-07/products/#{id}/metafields.json

Hide a resource from search engines and sitemaps

If you want to hide a resource from search engines and sitemaps, then you can use a metafield to add noindex and nofollow meta tags to the resource's pages.

To add noindex and nofollow meta tags to a resource's pages, create a new metafield for the resource with the following attributes:

  • "namespace" : "seo"
  • "key" : "hidden"
  • "value" : 1
  • "value_type" : "integer"

Example JSON request

This request would be used to hide a product from search engines and sitemaps:

POST /admin/api/2021-07/products/#{id}/metafields.json