跳转到主要内容
当你在 docs 文件夹中更改某个文件的路径时,该页面的 URL 路径也会随之变化。此类情况可能出现在重组文档结构或更改侧边栏 title 时。 使用我们的命令行界面(CLI)检测失效链接。安装命令行界面(CLI) 并运行以下命令:
mint broken-links
命令行界面(CLI)会检测文档中不存在的相对链接。

重定向

docs.json 文件中添加 redirects 字段即可设置 301 重定向。
"redirects": [
  {
    "source": "/source/path",
    "destination": "/destination/path"
  }
]
这会将 /source/path 永久重定向到 /destination/path,以避免丢失原页面既有的 SEO(搜索引擎优化)。 要匹配通配符路径,请在参数后添加 *。在此示例中,/beta/:slug* 会匹配 /beta/introduction 并将其重定向到 /v2/introduction
"redirects": [
  {
    "source": "/beta/:slug*",
    "destination": "/v2/:slug*"
  }
]
I