跳到正文
Skillpedia
SEO75k · #3061

trailing-slash

它能做什么

这项技能检查网站是否统一使用一种网址风格,即是否带结尾斜杠。适用于希望避免搜索结果中出现重复页面的网站所有者和开发者。

适用场景

  • ✓当网站对带结尾斜杠和不带结尾斜杠的网址都提供同一页面的时候。
  • ✓当内部链接、站点地图条目和 canonical 标签使用不同的网址风格的时候。
  • ✓当网站迁移到新平台,网址规则可能已改变的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/trailing-slash/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/trailing-slash/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“Google 把我的一些页面显示了两次,一次带结尾斜杠,一次不带。请帮我修复这些网址。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会测试两种网址版本,并检查内部链接和站点地图。然后它会推荐一种首选风格,并从另一种版本做永久重定向。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Use trailing slashes consistently

Inconsistent trailing slashes create duplicate content — Google sees /page and /page/ as two separate URLs competing for the same ranking, splitting PageRank between them.

Quick Reference

  • Pick one convention — trailing slash or no trailing slash — and enforce it site-wide with 301 redirects
  • Both /page/ and /page must not return HTTP 200; one must redirect to the other
  • Set rel="canonical" to the preferred version on all pages
  • Ensure all internal links, sitemaps, and canonical tags use the same convention

Check

For a sample of URLs, test both the trailing-slash and non-trailing-slash versions. Both should NOT return HTTP 200 — one must 301-redirect to the other. Check that internal links, sitemap <loc> values, and canonical tags all use the same convention consistently.

Fix

Choose a canonical URL convention. Add server or framework redirect rules so the non-preferred variant permanently redirects (301) to the preferred one. Update all internal links, canonical tags, and sitemap entries to use the preferred format.

Explain

Explain why /page and /page/ are treated as distinct URLs by default, how this creates duplicate content, and how 301 redirects and canonical tags resolve the ambiguity.

Code Review

Review metadata generation, rendered HTML, structured data, and response headers related to Use trailing slashes consistently. Flag exact routes or templates where search-facing output violates the rule, and describe how to verify the final page output.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/seo/trailing-slash

常见问题

为什么这两个网址会被视为不同?

默认情况下,搜索引擎会把 /page 和 /page/ 当作两个不同的地址,从而分散排名信号。

如何解决重复问题?

这项技能推荐从非首选版本做 301 重定向,并在页面上使用 canonical 标签。

站点地图也要更新吗?

需要。这项技能指出,站点地图条目应使用与首选网址相同的格式。

详情

作者的原始描述

Use when applies to all static and dynamic websites. Use when auditing a site for duplicate content, setting up a new site, or after migrating platforms that changed URL conventions.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#3061
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能