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

Favicon links not rendering when `sphinx_tabs` is activated

Open bryevdv opened this issue 2 years ago • 4 comments

With PST 0.9 and Sphinx 5.0 (and 4.x) I am no longer seeing favicon links appear in HTML output. Our config looks like:

    "favicons": [
        {
            "rel": "icon",
            "sizes": "16x16",
            "href": "https://static.bokeh.org/favicon/favicon-16x16.png",
        },
        {
            "rel": "icon",
            "sizes": "32x32",
            "href": "https://static.bokeh.org/favicon/favicon-32x32.png",
        },
        {
            "rel": "apple-touch-icon",
            "sizes": "180x180",
            "href": "https://static.bokeh.org/favicon/apple-touch-icon.png"
        },
    ]

which has not changed recently.

Things I have tried:

  • Removing all custom templates
  • Running sphinx non-parallel mode

I have put breakpoints in the installed PST modules and seen that the "favicons" config is picked up, and that the relevant calls to app.add_css_file are being made. I have put Sphinx in -vv ouptut, and can see lines like this show in the detailed log:

[app] adding stylesheet: 'https://static.bokeh.org/favicon/favicon-16x16.png'
[app] adding stylesheet: 'https://static.bokeh.org/favicon/favicon-32x32.png'
[app] adding stylesheet: 'https://static.bokeh.org/favicon/apple-touch-icon.png'

And yet, in the rendered HTML the links are simply... nowhere. There are no favicon links added to any of the pages. As a result the browser simply tries to load the default favicon.ico which 404s. This happens with local builds or you can see the last CI deploy here: https://docs.bokeh.org/en/dev-3.0/

I have no idea what could be going on here, or what else to look at. Any ideas for things to try or investigate are very welcome an appreciated.

Update: sphinx_tabs seems to be the culprit

In https://github.com/pydata/pydata-sphinx-theme/issues/781#issuecomment-1175406509 we confirmed that deactivating sphinx_tabs fixes the issue. However it's not clear why this breaks it in the first place.

bryevdv avatar Jul 01 '22 23:07 bryevdv

My preliminary analysis points towards the sphinx_tabs.tabs extension (v 3.4.0) as a potential culprit here. After removing this extension from Bokeh's conf.py (and removing all mentions of .. tabs:: in the docs), the favicons are back as expected. I don't know what exactly causes this issue between this extension and the theme, but I'll try replacing the tabs extension with the newer sphinx-design extension.

tcmetzger avatar Jul 02 '22 04:07 tcmetzger

Hmmm, I have no idea why sphinx_tabs would mess this up, but also have no idea what else would have changed this...I don't think we've changed the favicon logic much (if at all) since the last release 🤔

choldgraf avatar Jul 04 '22 08:07 choldgraf

@choldgraf I can confirm that after @tcmetzger's work to migrate to sphinx-design, the problem is resolved, and the deployed docs display the favicon as expected:

Screen Shot 2022-07-05 at 12 07 28

From my perspective, this issue could be closed. But I leave it to you in case your position is that sphinx_tabs should work

bryevdv avatar Jul 05 '22 19:07 bryevdv

I am very confused as to why sphinx_tabs is breaking this haha...

I'll re-scope the issue in case others run into this too, and if we can't find a fix or if nobody else reports similar issues after a few months, I suggest we just close this

choldgraf avatar Jul 05 '22 19:07 choldgraf

it's been few month right ? 😄

12rambau avatar Sep 29 '22 07:09 12rambau

Closing, but with the understanding that we'll happily review a PR if someone gets inspired to figure out the exact cause and propose a solution. For now using sphinx-design instead of sphinx-tabs seems like an acceptable workaround.

drammock avatar Sep 29 '22 13:09 drammock