Sphinx v1.0.1 Default theme's collapsiblesidebar option doesn't work

tpowers avatartpowers created an issue

The problem appears to be in layout.html:

    {% if theme_collapsiblesidebar|tobool %}
    {% set script_files = script_files + ['_static/sidebar.js'] %}
    {% endif %}

Since sidebar.js is in sphinx/themes/default/static/, I would have thought the above was unnecessary? I can see that sidebar.js is present in the output _static directory. However, no <script> tag is added to the generated HTML?

I spent awhile looking at the source and couldn't even figure out where the <script></script> tags were being written out?

Anyway, I fixed by doing the following in a custom theme's layout.html:

    {% extends "basic/layout.html" %}

    {%- block extrahead %}
    {{ super() }}
        <script type="text/javascript" src="{{ pathto("_static/sidebar.js", 1) }}"></script>
    {% endblock %}

But probably that same thing could be done inside default/layout.html?

Comments (3)

  1. tpowers

    ooops. It was because my custom theme was doing

      {% extends "basic/layout.html" %}

    instead of:

      {% extends "default/layout.html" %}

    I'd still like to know how the script_files get writen out :P

  2. tpowers

    Aha. It's in basic/layout.html:

        {%- for scriptfile in script_files %}
        <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
        {%- endfor %}
  3. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.