Sphinx exclude one Page from html_sidebars

霸气de小男生 提交于 2021-01-28 09:51:08

问题


I am using Sphinx to build user docs for an application. According to the documentation for build configuration file there is an html_sidebars setting with an example documentaion.

html_sidebars = {
'**': ['globaltoc.html', 'sourcelink.html', 'searchbox.html'],
'using/windows': ['windowssidebar.html', 'searchbox.html'],
}

I am looking to have all pages display the sidebar except one, I have only been able to achieve the inverse of that, where the sidebar appears on just one page and not the rest.

html_sidebars = {'index': ['localtoc.html']}

I know that its possible to use glob syntax and I've tried almost every variation of [!index] I can think of without success.


回答1:


You will need to have your expression match everything except the string 'index'. Unfortunately globbing is not that flexible. There are several ways of working around it.

  1. explicitly list each file except index
  2. rename the files that you want to have the sidebar with a prefix or suffix, and use a corresponding globbing pattern to match only those files
  3. move the files into a subdirectory, and use a corresponding globbing pattern
  4. try [!x], assuming no other file has "x" in its name (i, n, d, and e are too common)
  5. possibly something else?



回答2:


I had the same issue, and was able to achieve the desired result using:

html_sidebars = {
    '**': ['localtoc.html'],
    'index': []
}


来源:https://stackoverflow.com/questions/45112812/sphinx-exclude-one-page-from-html-sidebars

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!