Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python sphinx 自定义Sphinx以避免生成搜索框_Python Sphinx - Fatal编程技术网

Python sphinx 自定义Sphinx以避免生成搜索框

Python sphinx 自定义Sphinx以避免生成搜索框,python-sphinx,Python Sphinx,是否有一种简单的方法(即,不创建全新的主题)来定制Sphinx,以便它在不使用搜索框的情况下生成HTML页面?您可以通过定制(或者我应该说禁用)搜索框模板来实现这一点 在conf.py中,添加以下行: templates_path = ["templates"] 在Sphinx项目目录中创建一个名为templates的文件夹 在该文件夹中,添加一个名为searchbox.html的空文件。这将覆盖默认模板文件(位于安装sphinx的sphinx/themes/basic中) 我在阅读时发现的

是否有一种简单的方法(即,不创建全新的主题)来定制Sphinx,以便它在不使用搜索框的情况下生成HTML页面?

您可以通过定制(或者我应该说禁用)搜索框模板来实现这一点

  • 在conf.py中,添加以下行:

    templates_path = ["templates"]
    
  • 在Sphinx项目目录中创建一个名为
    templates
    的文件夹

  • 在该文件夹中,添加一个名为searchbox.html的空文件。这将覆盖默认模板文件(位于安装sphinx的
    sphinx/themes/basic
    中)


  • 我在阅读时发现的另一种方法是,在
    conf.py
    文件中明确列出所需的工具条(如果有)。例如,将此片段包括在
    conf.py
    中:

    html_theme = 'alabaster'
    html_sidebars = {
        '**': [
            'about.html',
            'navigation.html',
            'searchbox.html',
        ]
    }
    

    生成搜索框;从该列表中删除
    searchbox.html
    ,然后生成相同的页面,但不包含该框。(更多信息请访问。)

    这似乎比您选择的方法更干净。