This guide explains how SEO works in Hydrogen and the output of SEO-related tags in your Hydrogen storefront.
How SEO works in HydrogenAnchor link to section titled "How SEO works in Hydrogen"
Hydrogen includes an
Seo component that renders SEO information on a webpage, as well as the following example files in the Demo Store template:
[sitemap.xml].tsx: Generates all products, collections, and pages URLs using the Storefront API
[robots.txt].tsx: A file that sets default rules for which URLs can be crawled by search engines
Anchor link to section titled "Seo component"
Seo component is rendered at the
root module and collects data defined in the
handle export of each route. The data defined in each route is used to generate the
<head> tags that search engines look for.
Learn how to add the
Seo component and customize
<head> tags at each route level.
Limitations and considerationsAnchor link to section titled "Limitations and considerations"
The following limitations and considerations apply to the XML sitemap that's included in the Demo Store template:
- The sitemap has a limit of 250 products, 250 collections, and 250 pages. You need to paginate results if your store has more than 250 resources.
When you add or remove pages, the sitemap is automatically updated within one day. Similarly, if you unpublish a product, then the product is removed automatically from the sitemap.
The sitemap is cached for 24 hours.
By default, the sitemap uses the
onlineStoreUrlfield from the Storefront API as the URL. It falls back to the Demo Store template URL structure, which is based on resource's handle.
Related componentsAnchor link to section titled "Related components"
- Learn how to perform common tasks for managing routes SEO in Hydrogen.
- Learn about the analytics support built into Hydrogen.