要点
一、同一商品可以通过 /products/ 和 /collections/xxx/products/ 两种路径访问,Shopify 靠自动 canonical 和主题内链处理。主题里的 within 过滤器会生成带集合上下文的商品网址,例如 /collections/sale-potions/products/draught-of-immortality。Shopify 开发者文档在这个过滤器下提醒:标准商品页和集合上下文里的商品页内容相同、网址不同,使用前要考虑 SEO 影响。Shopify 帮助中心说明店铺会自动给页面加 canonical 标签,避免重复内容出现在搜索结果里;主题在 <head> 里用全局 Liquid 对象 {{ canonical_url }} 输出 canonical。Shopify 官方文档没有写明集合路径商品页的 canonical_url 具体返回哪个网址,实际指向要看渲染后的页面源代码。
这类重复路径不能用后台的网址跳转处理:Shopify 不允许对 /products、/collections、/collections/all 这些固定路径建跳转,而且跳转只对已经返回 404 的网址生效,网址仍能正常打开时跳转不起作用。由此推断(非 Shopify 原话),能控制的是主题里商品链接是否使用 within,以及 canonical 输出是否正确。
二、sitemap 自动生成,位于每个域名根目录的 /sitemap.xml。它是一个索引文件,下面分别链接商品、集合、博客、页面的子 sitemap,包含商品、商品主图、页面、集合和博客文章;新增页面、商品、集合、图片或博客文章时自动更新。具体规则:
- Basic 及以上套餐使用国际域名时,每个域名各有一套 sitemap,需要分别提交到 Search Console;多语言内容自动加入各域名的 sitemap。
- 有多个域名但不用于国际定位时,Shopify 建议把它们都跳转到主域名。
- 店铺开启密码保护(私密模式)时,Google 读不到 sitemap。
- 商品设为 Unlisted(未列出)状态,或给商品、页面、博客文章设置
seo.hidden元字段值为 1,会从 sitemap 和搜索引擎中隐藏。 - 使用 Shopify Markets 时,sitemap 包含各市场的网址,每个网址带 hreflang 标注;新增子目录、子域名或独立域名市场后,sitemap 自动加入该市场的页面。
三、robots.txt 默认自动生成,通过 robots.txt.liquid 模板修改。文件位于主域名根目录 /robots.txt。Shopify 说明默认规则适用于多数店铺,主要几条:
Allow: /,开放商品、集合、页面、博客、政策页。Disallow: /admin、/cart/、/checkout、/checkouts/、/account、/orders,屏蔽后台、购物车、结账和账户页。Disallow: /collections/*+*,屏蔽筛选后的集合页,理由是与集合页内容重复;Disallow: /collections/*sort_by*,屏蔽排序后的集合页,理由是商品相同只是顺序不同。
可做的修改有四类:允许或禁止抓取特定网址、为特定爬虫加 crawl-delay、增加 sitemap 网址、屏蔽特定爬虫。创建方法是在主题代码编辑器里 Add a new template,选择 robots。模板只支持 robots、group、rule、user_agent、sitemap、request 这几个 Liquid 对象;Shopify 推荐保留遍历 robots.default_groups 的写法,在其中增删规则,这样 Shopify 以后还能自动更新默认规则;把模板整个换成纯文本规则不被推荐。用 Shopify Markets 且各市场有独立域名或子域名时,可以用 request.host 写分域名规则。
几条限制:这是 Shopify 不提供支持的自定义,客服不帮忙改,用错可能导致流量全部丢失;在后台 Themes 页面上传主题不会导入 robots.txt.liquid,ThemeKit 或命令行会保留;旧模板可能仍带默认文件已去掉的规则(如 /search、/policies/),删除模板即恢复当前默认文件。robots.txt 不能让页面不被编入索引,要隐藏单个页面或商品,Shopify 给出的方法是在 theme.liquid 的 <head> 里按 handle 或模板输出 <meta name="robots" content="noindex">,或使用 Unlisted 状态、seo.hidden 元字段。
四、商品和集合的 title、description 在各自编辑页的 Search engine listing 区域设置。
| 页面类型 | 后台位置 |
|---|---|
| 商品 | Products,点进商品,Search engine listing 区域点铅笔图标 |
| 集合 | Products > Collections,点进集合,Search engine listing 区域点铅笔图标 |
| 页面 | Online Store > Pages,点进页面,Edit website SEO |
| 首页 | Online Store > Preferences,Social sharing image and SEO 区域 |
区域里有 Page title、Meta description、URL handle 三个字段。商品和集合的帮助页写的是标题超过 70 字符、描述超过 320 字符可能在搜索结果中被截断;关键词帮助页建议标题不超过 60 字符、描述用 160 字符左右。修改集合 handle 时可以勾选从旧网址创建跳转;Shopify 提醒不要频繁修改 handle,否则商品或集合可能不出现在搜索结果中。title 留空时,主题会用“店铺名加内容标题”或“内容标题加店铺名”。主题里 title 由 theme.liquid 中的 {{ page_title }} 输出,描述由 page_description 输出。
五、Shopify Markets 的子目录和 hreflang 默认自动处理。
- 网址结构可选子目录(
yourstore.com/fr/)、子域名(fr.yourstore.com)、国家顶级域名(yourstore.fr),Shopify 推荐多数店铺用子目录,理由是设置最简单、不用另注册域名、与主域名共享权重。 - hreflang 默认对每家店铺开启,通过
content_for_header输出到主题<head>;只给有独立域名、子域名或子目录的市场生成;按市场的语言和地区生成en-us这类带地区的代码或de这类只有语言的代码;另有一条x-default指向主域名;市场的域名或语言变化后自动更新。 - 各市场版本的页面(如
/products/shirt和/fr/products/shirt)各自 canonical 指向自己,再用 hreflang 互相关联。 - 自动跳转(按访客位置跳到对应市场)只作用于顾客,已知的搜索引擎爬虫不会被跳转,访问哪个网址就拿到哪个网址的内容。
- 后台建的网址跳转会应用到各语言和市场子目录,例如从
/products/blue-t-shirt跳到/collections/t-shirts,/en-ca/下的访客会跳到/en-ca/collections/t-shirts。不同子目录要跳到不同目标,或从一个子目录跳到另一个子目录,需要为每个子目录单独建。 - 商品结构化数据里的
priceCurrency要反映购物车币种,而不是店铺默认币种。
主题或应用已经输出 hreflang 时,Shopify 建议在 Online Store > Preferences 的 Social sharing image and SEO 区域关闭 Automatic hreflang tags,避免重复或矛盾的标注;关闭后要自己用 localization 对象动态生成标签,不要写死域名或 handle,并让每个本地化网址的 canonical 指向自己。Shopify 提醒,在没有替代方案时关闭自动 hreflang 可能对 SEO 不利。
容易误解的地方
- 想用后台网址跳转把
/collections/xxx/products/yyy跳到/products/yyy。固定路径不能建跳转,能正常打开的网址也不能跳转。 - 以为删掉
robots.txt.liquid里的 Liquid 循环、改写成纯文本更好控制。Shopify 不推荐,纯文本规则会过时,Shopify 也无法再自动更新。 - 用 robots.txt 屏蔽某个商品来让它不出现在搜索结果里。屏蔽只管抓取,隐藏商品用 noindex、Unlisted 或
seo.hidden。 - 主题、应用和 Shopify 自动功能同时输出 hreflang,页面上出现两套标注。
- 以为子目录市场的 hreflang 要手动添加。默认已自动开启。
- 修改商品或集合 handle 后没有建旧网址跳转。
- 后台改了 title,Google 结果里显示的仍不同,就以为没保存。Shopify 说明搜索引擎可能改写标题和描述,先查看页面源代码里的
<title>和<meta name="description">是否已经更新。
怎么检查
- 打开集合页,查看商品卡片链接是否带
/collections/路径;再打开一个集合路径的商品页,在源代码里看<link rel="canonical">指向哪个网址。 - 修改
robots.txt.liquid前保存一份当前/robots.txt输出,改完后对比渲染结果;确认默认的购物车、结账、筛选、排序规则还在。 - 打开每个域名的
/sitemap.xml,确认子 sitemap 齐全,Unlisted 和设了seo.hidden的商品不在其中;每个域名分别在 Search Console 提交。 - 在子目录市场页面的源代码里查看 hreflang 和
x-default,确认只有一套标注,canonical 指向页面自身。 - 用 Search Console 网址检查工具看 Google 抓到的 title、canonical 和 Google 选定的规范网址。
来源
- SEO overview,https://help.shopify.com/en/manual/promoting-marketing/seo/seo-overview(2026-10-05 核对)
- Liquid filters: within,https://shopify.dev/docs/api/liquid/filters/within(2026-10-05 核对)
- Liquid objects: canonical_url,https://shopify.dev/docs/api/liquid/objects/canonical_url(2026-10-05 核对)
- Add SEO metadata to your theme,https://shopify.dev/docs/storefronts/themes/seo/metadata(2026-10-05 核对)
- Creating and managing URL redirects,https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect(2026-10-05 核对)
- Finding and submitting your sitemap,https://help.shopify.com/en/manual/promoting-marketing/seo/find-site-map(2026-10-05 核对)
- Hiding a page from search engines,https://help.shopify.com/en/manual/promoting-marketing/seo/hide-a-page-from-search-engines(2026-10-05 核对)
- Editing robots.txt.liquid,https://help.shopify.com/en/manual/promoting-marketing/seo/editing-robots-txt(2026-10-05 核对)
- Customize robots.txt,https://shopify.dev/docs/storefronts/themes/seo/robots-txt(2026-10-05 核对)
- Adding and updating products,https://help.shopify.com/en/manual/products/add-update-products(2026-10-05 核对)
- Managing collection settings,https://help.shopify.com/en/manual/products/collections/collection-settings(2026-10-05 核对)
- Adding keywords for SEO to your Shopify store,https://help.shopify.com/en/manual/promoting-marketing/seo/adding-keywords(2026-10-05 核对)
- International SEO for markets,https://help.shopify.com/en/manual/markets/seo(2026-10-05 核对)
- Use hreflang tags in your theme,https://shopify.dev/docs/storefronts/themes/seo/hreflang(2026-10-05 核对)
- Support multiple currencies and languages,https://shopify.dev/docs/storefronts/themes/markets/multiple-currencies-languages(2026-10-05 核对)
