# Markdown 链接

There are two ways of adding a link to another page: through a URL path and a file path.

- [URL path to another document](./installation)- [file path to another document](./installation.mdx)

URL paths are unprocessed by Docusaurus, and you can see them as directly rendering to <a href="./installation">, i.e. it will be resolved according to the page's URL location, rather than its file-system location.

If you want to reference another Markdown file included by the same plugin, you could use the relative path of the document you want to link to. Docusaurus' Markdown loader will convert the file path to the target file's URL path (and hence remove the .md extension).

For example, if you are in docs/folder/doc1.md and you want to reference docs/folder/doc2.md, docs/folder/subfolder/doc3.md and docs/otherFolder/doc4.md:

docs/folder/doc1.md
I am referencing a [document](doc2.mdx).Reference to another [document in a subfolder](subfolder/doc3.mdx).[Relative document](../otherFolder/doc4.mdx) referencing works as well.

You can write [links](/otherFolder/doc4.mdx) relative to the content root (/docs/).You can also write [links](/docs/otherFolder/doc4.mdx) relative to the site directory, but it's not recommended.

Using relative file paths (with .md extensions) instead of relative URL links provides the following benefits:

• 链接能在 GitHub 界面和许多 Markdown 编辑器里工作
• 你可以自定义文件的 slug，而不必更新所有链接
• 文件在不同文件夹之间的移动可以被你的编辑器追踪，而且一些编辑器可以自动更新文件链接
• A versioned doc will link to another doc of the exact same version
• Relative URL links are very likely to break if you update the trailingSlash config
warning

Markdown 文件链接仅在源文件和目标文件是被同一个插件实例所处理的时候才能工作。 这是我们 Markdown 处理架构的技术限制，会在以后被修复。 如果你的链接跨越了两个插件（例如在一篇博客帖子中链接到一个文档页面），你必须用 URL 链接。