How do I customize Sphinx RtD Theme default search settings?

吃可爱长大的小学妹 提交于 2019-11-28 05:59:43

问题


How do I override the default Search html that comes with the Sphinx RTD theme. I am on Sphinx 1.5 and the theme is always imported and not static.


回答1:


See Templating in the Sphinx documentation.

To customize the output of your documentation you can override all the templates (both the layout templates and the child templates) by adding files with the same name as the original filename into the template directory of the structure the Sphinx quickstart generated for you.

Sphinx will look for templates in the folders of templates_path first, and if it can’t find the template it’s looking for there, it falls back to the selected theme’s templates.

In your case, copy the RTD Sphinx theme's search.html from your installed package into your template directory, and modify it to your liking. Then set the value of templates_path in your conf.py to its location.



来源:https://stackoverflow.com/questions/44154226/how-do-i-customize-sphinx-rtd-theme-default-search-settings

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