Search code examples
python-sphinxread-the-docs

SphinxRtdTheme undefined after making custom-named fork of sphinx_rtd_theme


I am working on a theme which is a fork of sphinx_rtd_theme. I renamed the theme so that people who would use the theme would not have to worry about overwriting their usual sphinx_rtd_theme.

However, when building documents using the custom theme, the collapse_navigation theme option is not respected. Other elements in html_theme_options are respected, however. And collapse_navigation is respected if I use sphinx_rtd_theme instead of my custom theme.

In the web console, I see

jQuery.Deferred exception: SphinxRtdTheme is not defined @http://localhost:1919/:522:11
j@http://localhost:1919/_static/jquery.js:2:29997
g/</k<@http://localhost:1919/_static/jquery.js:2:30313
 undefined

ReferenceError: SphinxRtdTheme is not defined[Learn More] localhost:1919:522:11
<anonymous> http://localhost:1919/:522
    jQuery 2

Which sort of makes sense - I did rename my theme and I believe these references should be SphinxCustomRtdTheme now. Except...

The only 2 (human-readable) references to SphinxRtdTheme in the core theme (https://github.com/rtfd/sphinx_rtd_theme/search?q=SphinxRtdTheme&unscoped_q=SphinxRtdTheme) have already been changed to use my custom name, so it's not clear to me where SphinxRtdTheme exists in my theme at this point.

I've cleaned out the /my_custom_theme/static/ folder already to force a rebuild of any Javascript, but to no avail.

I also tried renaming my SphinxCustomRtdTheme entries back to SphinxRtdTheme, but there was no change in the error.

Ideally, this error wouldn't exist, and then (also ideally) collapse_navigation would be respected properly for my theme.


Solution

  • It turns out that my theme was being built into a separate version (dev0) than I expected, and thus it was perpetually stuck on a previous version. Updating everything to the current version removes the errors.