--- title: Optimize storefront SEO description: >- Change the way a store's pages appear in search engine results by updating the meta tags. source_url: html: >- https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo md: >- https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md --- ExpandOn this page * [Requirements](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md#requirements) * [Step 1: Update a resource's search engine listing](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md#step-1-update-a-resources-search-engine-listing) * [Step 2: Hide a resource from search engines and sitemaps](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md#step-2-hide-a-resource-from-search-engines-and-sitemaps) * [Next steps](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md#next-steps) # Optimize storefront SEO 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. For example, when you create a product, the page title and meta description for the product page defaults to the product title and description. This guide shows you how to change these default values using the GraphQL Admin API's [SEO fields](https://shopify.dev/docs/api/admin-graphql/latest/objects/seo). *** ## Requirements * Your app can make [authenticated requests](https://shopify.dev/docs/api/admin-graphql#authentication) to the GraphQL Admin API. * There are [products](https://shopify.dev/docs/api/admin-graphql/latest/objects/Product), [collections](https://shopify.dev/docs/api/admin-graphql/latest/objects/Collection), [articles](https://shopify.dev/docs/api/admin-graphql/latest/objects/Article), [pages](https://shopify.dev/docs/api/admin-graphql/latest/objects/Page) or [blogs](https://shopify.dev/docs/api/admin-graphql/latest/objects/Blog) on the store. * You're familiar with [how metafields work](https://shopify.dev/docs/apps/build/custom-data/metafields). *** ## Step 1: Update a resource's search engine listing You can update a resource's page title and meta description using the `title` and `description` fields in the SEO field. The following example updates both the title and description for a product's search engine listing: ## POST https://{shop}.myshopify.com/api/{api\_version}/graphql.json ## GraphQL mutation ```graphql mutation { productUpdate( input: { id: "gid://shopify/Product/5591484858390" seo: { title: "Matte black sunglasses" description: "Premium polarized sunglasses with UV protection" } } ) { product { id seo { title description } } userErrors { field message } } } ``` ## JSON response ```json { "data": { "productUpdate": { "product": { "id": "gid://shopify/Product/5591484858390", "seo": { "title": "Matte black sunglasses", "description": "Premium polarized sunglasses with UV protection" } }, "userErrors": [] } } } ``` You can also query a resource's current SEO settings: ## POST https://{shop}.myshopify.com/api/{api\_version}/graphql.json ## GraphQL query ```graphql query { product(id: "gid://shopify/Product/5591484858390") { id title seo { title description } } } ``` ## JSON response ```json { "data": { "product": { "id": "gid://shopify/Product/5591484858390", "title": "Sunglasses", "seo": { "title": "Matte black sunglasses", "description": "Premium polarized sunglasses with UV protection" } } } } ``` Note The SEO field structure is available for `Product`, `Collection`, `Article`, `Blog`, and `Page`. Use the appropriate mutation ([`pageUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/pageUpdate), [`collectionUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/collectionUpdate), [`articleUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/articleUpdate), [`blogUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/blogUpdate), or [`pageUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/pageUpdate)) with the same `seo` input structure. *** ## Step 2: 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: ```json "namespace": "seo", "key": "hidden", "value": 1, "type": "number_integer" ``` Note If you hide resources from the sitemap, then they won't appear in search results when customers use [storefront search](https://help.shopify.com/manual/online-store/storefront-search). If you delete the metafield using the [GraphQL Admin](https://shopify.dev/docs/apps/build/custom-data/metafields/manage-metafields#step-4-optional-delete-a-metafield), then the `noindex` and `nofollow` meta tags are removed. The following example hides a product from search engines and sitemaps: ## POST https://{shop}.myshopify.com/api/{api\_version}/graphql.json ## GraphQL mutation ```graphql mutation { productUpdate( input: { id: "gid://shopify/Product/5591484858390" metafields: [ { namespace: "seo", key: "hidden", value: "1", type: "number_integer", } ] } ) { product { metafields(first: 10) { edges { node { key value } } } } } } ``` ## JSON response ```json { "data": { "productUpdate": { "product": { "metafields": { "edges": [ { "node": { "key": "hidden", "value": "1" } } ] } } } } } ``` *** ## Next steps * Consult the metafield reference for the [GraphQL Admin API](https://shopify.dev/docs/api/admin-graphql/latest/objects/metafield). * [Create marketing events](https://shopify.dev/docs/api/admin-graphql/latest/objects/MarketingEvent) for your app to help merchants market products, collections, discounts, and more. *** * [Requirements](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md#requirements) * [Step 1: Update a resource's search engine listing](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md#step-1-update-a-resources-search-engine-listing) * [Step 2: Hide a resource from search engines and sitemaps](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md#step-2-hide-a-resource-from-search-engines-and-sitemaps) * [Next steps](https://shopify.dev/docs/apps/build/marketing-analytics/optimize-storefront-seo.md#next-steps)