How to output a custom static file in Sphinx?

北战南征 提交于 2021-02-05 06:01:29

问题


Using Sphinx, one can include static files in the _static folder of the build output. How could I copy a static file to the root of the build folder?

Background: I'm hosting the output of a Sphinx project in Azure App Services, and because of a mp4 video in a few pages, I need a "web.config" file with the following entry:

<staticContent>
    <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>

I need Sphinx to include the web.config in the root of the build folder.


回答1:


Use html_extra_path. This is a configuration option that will copy the list of files given to the html build directory:

html_extra_path = ['path/to/web.config']


来源:https://stackoverflow.com/questions/53282461/how-to-output-a-custom-static-file-in-sphinx

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