How to output a custom static file in Sphinx?

Viewed 1477

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 Answers

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']
Related