首页 > 解决方案 > 防止 Gitbook 转换相对链接

问题描述

我们的 gitbook 文档必须与托管在不同位置的同一服务器上的其他文档有交叉链接。

我们有这些链接:

<a href="/stuff/documentation/api-reference.html">API Reference</a>
[API Reference](/stuff/documentation/api-reference.html)

这两个链接都由 Gitbook 转换为相对于当前页面的链接(这是针对比索引页面嵌套更深 1 级的页面):

<a href="../stuff/documentation/api-reference.html">API Reference</a>

如果带有链接的页面嵌套更深:

<a href="../../../stuff/documentation/api-reference.html">API Reference</a>

我们需要的是 Gitbook 来保持链接中的相对 URL 完全“原样”,因此它们将导致最终文档服务器上的正确路径:

<a href="/stuff/documentation/api-reference.html">API Reference</a>

到目前为止,唯一可行的解​​决方案是将 JS 代码导航到<a>Markdown 内 HTML 标记中所需的相对路径,但这是一个非常丑陋的解决方法。

标签: gitbook

解决方案


推荐阅读