pydata-sphinx-theme icon indicating copy to clipboard operation
pydata-sphinx-theme copied to clipboard

Variable `html_theme_options:logo` incompatible with Sphinx `_static` Logic

Open michaelweinold opened this issue 1 year ago • 1 comments

(This issue addresses what seems to be a separate problem from the related discussion here: https://github.com/pydata/pydata-sphinx-theme/issues/1328#issuecomment-1619521455)

Irregardless of the path I use for the logo: image_light theme variable:

source/_static/logo/logo_light.svg
./_static/logo/logo_light.svg
logo/logo_light.svg
../../_build/html/_static/logo/logo_light.svg

the builder always ends up looking for the file at:

_static/logo_light.svg

This file, however, won't ever exist - since Sphinx (as per the documentation) copies the subdirectories of the _static directory:

docs/
├── source/
│   ├── _static/
│   |    └── logo/
|   |         ├── logo_light.svg
│   |         └── logo_dark.svg
│   └── index.md
└── conf.py
docs/
└── build/
    └── html/
         └── _static/
              └── logo/
                  ├── logo_light.svg
                  └── logo_dark.svg

The way the theme is presently set up won't allow for sub-directories of the _static directory. since the theme variable seems to be incompatible with the logic that Sphinx uses to copy subdirectories of the _static directory to _build.

If I understand the comments of @12rambau correctly, the expected (and Sphinx-compatible) behaviour would be that the path passed to the logo: image_light variable should be relative to the _build/html/_static directory.

For convenient testing, I added a MWE to this repo: michaelweinold/mwe_sphinx

michaelweinold avatar Jul 10 '23 18:07 michaelweinold

...I might add that this seemingly does not affect the output of a readthedocs build (for some weird reason).

michaelweinold avatar Jul 10 '23 18:07 michaelweinold