Manage meta tags for SEO with the Admin API
You can change the way a product, page, collection, blog, or article appears in search engine results by updating the resource's meta tags. The meta tags are the page title and the meta description, which are part of the resource's search engine listing.
Requirements
Anchor link to section titled "Requirements"- You've added resources, such as products or collections, to your store.
- You're familiar with how metafields work.
How it works
Anchor link to section titled "How it works"You can edit the page title and meta description for resource pages on your site.
For example, when you create a product, the page title and meta description for the product page defaults to the product title and description. You can update these default values in the following ways:
- Create the specific metafields described in this section by updating the product using the GraphQL Admin and REST Admin APIs.
- Edit the website SEO for the product in the Shopify admin.
After you've updated the page title and meta description, the values are stored in the title_tag
and description_tag
metafields. These metafields are both in the global
namepsace have the single_line_text_field
type.
Update a resource's search engine listing
Anchor link to section titled "Update a resource's search engine listing"If the resource's search engine listing has never been updated, you can update the page title and meta description by creating the title_tag
and description_tag
metafields.
If the resource's search engine listing has already been updated, then you can update the title_tag
and description_tag
metafields by specifying the ID of the metafield you want to update.
The following example request changes the title for a product's search engine listing.
GraphQL: Create a new metafield
Anchor link to section titled "GraphQL: Create a new metafield"You can create a new metafield by updating the product:
GraphQL: Update an existing metafield
Anchor link to section titled "GraphQL: Update an existing metafield"If the metafield already exists because it was created through the API or because the search listing was updated in the Shopify admin, then you need to supply the metafield ID to update the metafield:
REST: Create a new metafield
Anchor link to section titled "REST: Create a new metafield"You can create a new metafield by updating the product:
REST: Update an existing metafield
Anchor link to section titled "REST: Update an existing metafield"If the metafield already exists because it was created through the API or because the search listing was updated in the Shopify admin, then you need to supply the metafield ID to update the metafield:
Hide a resource from search engines and sitemaps
Anchor link to section titled "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 automatically 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:
The following example request hides a product from search engines and sitemaps:
GraphQL
REST
- Consult the metafield reference for the GraphQL Admin and REST Admin APIs.
- Create marketing events for your app to help merchants market products, collections, discounts, and more.