Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable html_theme_options:logo incompatible with Sphinx _static Logic #1385

Closed
Tracked by #106
michaelweinold opened this issue Jul 10, 2023 · 1 comment · Fixed by #1746
Closed
Tracked by #106

Variable html_theme_options:logo incompatible with Sphinx _static Logic #1385

michaelweinold opened this issue Jul 10, 2023 · 1 comment · Fixed by #1746
Labels
impact: high Something that is relevant to nearly all users kind: bug Something isn't working

Comments

@michaelweinold
Copy link
Contributor

(This issue addresses what seems to be a separate problem from the related discussion here: #1328 (comment))

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
Copy link
Contributor Author

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

@12rambau 12rambau added kind: bug Something isn't working impact: high Something that is relevant to nearly all users labels Oct 25, 2023
Carreau pushed a commit that referenced this issue May 27, 2024
I think this fixes #1385, I think that bug report is expecting to be able to pass a logo in the docs/_static directory but according to the docs here: https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/branding.html#different-logos-for-light-and-dark-mode the path should be relative to conf.py.

I think the actual bug is that we were not passing the correct source to the sphinx copy function which exits silently (for some reason) if the source does not exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact: high Something that is relevant to nearly all users kind: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants