首页 > 解决方案 > 当页面上不存在该短语时,“正在搜索...”将永远占用 readthedocs

问题描述

当我搜索 readthedocs 页面上不存在的短语时,我收到以下消息:

“正在搜索……”,这将永远持续下去。相反,当我搜索一些已知的短语时,我会在一秒钟内得到结果。

我查看了页面的控制台:

来自“https://xxxxxx.readthedocs.io/en/latest/_static/css/yy.css”的资源因 MIME 类型(“text/html”)不匹配(X-Content-Type-Options: nosniff)而被阻止)。阅读文档搜索失败。回退到 Sphinx 搜索。

我努力了:

  1. [conf.py] 我有一行:

    html_css_files = [
        "css/yy.css",
    ]
    

所以我补充说:

app.add_css_file(html_css_files)def setup(app):

但这导致 readthedocs 中的构建错误

  1. 我在conf.py中添加了:

    notfound_urls_prefix = "/projects/xxxxxx/en/latest/"
    

但这也没有帮助。

你遇到过类似的事情吗?如果是这样,您是如何解决问题的?

标签: pythonfull-text-searchpython-sphinxread-the-docs

解决方案


最后,根本原因在其他地方。当我查看 rtd 上的原始输出时,我发现 sphinx_rtd_theme 安装了 0.4.3,这不是最新的。最新的是 0.5.2。所以我将最新版本固定在我的 docs/requiremets.txt 中。这解决了搜索问题。


推荐阅读