[FIX] Use logo url as is to allow for web urls.#661
[FIX] Use logo url as is to allow for web urls.#661choldgraf merged 1 commit intoexecutablebooks:masterfrom
Conversation
`logo_url` can sometimes be a fully qualified URL starting in Sphinx 4. Adding the `_static` prefix breaks logos that are URLs.
|
Thanks for submitting your first pull request! You are awesome! 🤗 |
|
Thanks for the PR - one question, won't this break local paths because we're removing the |
|
@choldgraf the HTML builder handles this in Sphinx 4+ master: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/builders/html/__init__.py#L1254-L1255 |
| {% endif %} | ||
| {% if logo_url %} | ||
| <img src="{{ pathto('_static/' + logo_url, 1) }}" class="logo" alt="logo"> | ||
| <img src="{{ logo_url|e }}" class="logo" alt="logo"> |
There was a problem hiding this comment.
Why is this being escaped? Isn't it an already-encoded URL?
There was a problem hiding this comment.
@pradyunsg I don't think that's guaranteed since the logo_url value comes from the user in conf.py and the code I linked to above doesn't seem to be escaping anything.
There was a problem hiding this comment.
You're correct and I have to go fix something in Furo. :)
|
x-ref pradyunsg/furo#253 where I'd discovered this as well. :) |
choldgraf
left a comment
There was a problem hiding this comment.
Many thanks for this fix and for linking to the sphinx code where this is now handled! :-)
|
Thanks for the quick reviews @choldgraf and @pradyunsg, when do you guys think this will be released in a new version? |
|
There's a release candidate out now and this will make it into the next RC i think |
|
@fenil/@choldgraf The master version of sphinx-book-theme doesn't use the sidebar-logo.htm anymore, but instead the navbar-logo.html from the pydata theme. That version does check that the if the string is an URL, but if not it prepends A workaround is to specify the logo using the PyData logo config (light and dark theme). I guess that prevents sphinx from also prepending the |
|
@melund it sounds like maybe this same fix needs to be made in navbar-logo.html as well? |


logo_urlcan sometimes be a fully qualified URL starting in Sphinx 4.Adding the
_staticprefix breaks logos that are URLs.