Skip to content

hmtl_extra_path ignores directories and file architecture. #14236

@MartinFillon

Description

@MartinFillon

Describe the bug

Hi, I am trying to setup a way to have my json schemas in the html generated by sphinx for ease of use and ease of deployement. I found on the documentation html_extra_path that states that Relative paths are taken as relative to the [configuration directory](https://www.sphinx-doc.org/en/master/glossary.html#term-configuration-directory) therefore when copying a path such as cli/docs/config.schema.json I expected the file to go in the same directory but it ends up at the root of the resulting directory.
This is an expected behaviour from shutil (the dependency used to copy files, https://docs.python.org/3/library/shutil.html#shutil.copy). However it does not align with the documentation.

How to Reproduce

conf.py

html_extra_path=["cli/docs/config.schema.json"]
html_theme = "sphinx_rtd_theme"

file tree example

.
├── cli
│   ├── docs
│   │   └── config.schema.json
│   └── index.rst
├── conf.py
├── engine
│   └── index.rst
├── index.rst
└── LICENSE

execution command

sphinx-build -b html . gh-pages

Environment Information

Platform:              linux; (Linux-6.18.2-arch2-1-x86_64-with-glibc2.42)
Python version:        3.13.11 (main, Dec  7 2025, 13:01:45) [GCC 15.2.1 20251112])
Python implementation: CPython
Sphinx version:        8.2.3
Docutils version:      0.21.2
Jinja2 version:        3.1.6
Pygments version:      2.19.2

Sphinx extensions

none

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions