gpt4 book ai didi

Mkdocs 超链接在静态页面中不起作用

转载 作者:行者123 更新时间:2023-12-02 08:50:09 26 4
gpt4 key购买 nike

我正在尝试使用 mkdocs 构建文档。问题是静态创建的页面中的链接不起作用。我没有转到 [folder]/index.html,而是看到了以下页面,如下所示 image

但是,当我尝试 mkdocs 服务时,问题并不存在

最佳答案

设置use_directory_urls在您的 mkdocs.yml 配置文件中设置为 false:

use_directory_urls: false

文档说明:

This setting controls the style used for linking to pages within the documentation.

The following table demonstrates how the URLs used on the site differ when setting use_directory_urls to true or false.

Source file  | Generated HTML       | use_directory_urls: true | use_directory_urls: false
------------ | -------------------- | ------------------------ | ------------------------
index.md | index.html | / | /index.html
api-guide.md | api-guide/index.html | /api-guide/ | /api-guide/index.html
about.md | about/index.html | /about/ | /about/index.html

The default style of use_directory_urls: true creates more user friendly URLs, and is usually what you'll want to use.

The alternate style can occasionally be useful if you want your documentation to remain properly linked when opening pages directly from the file system, because it create links that point directly to the target file rather than the target directory.

最后一段是造成差异的关键。

关于Mkdocs 超链接在静态页面中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48063231/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com