readthedocs / sphinx_rtd_theme

Sphinx theme from Read the Docs
https://sphinx-rtd-theme.readthedocs.io/
MIT License
4.75k stars 1.73k forks source link

Inlcuding jquery.js in layout.html #1501

Closed kapooramit closed 1 month ago

kapooramit commented 1 year ago

I am trying to follow the instruction to include jquery.js in the layout.html by adding the following lines to the layout.html in the <head>.

{%- block scripts %}
    <script src="{{ pathto('_static/jquery.js', resource=True) }}"></script>
    <script src="{{ pathto('_static/underscore.js', resource=True) }}"></script>
    {{ super() }}
{%- endblock %}

[https://github.com/sphinx-doc/sphinx/issues/7405]

However, the above code causes the output HTML to throw the double script block error. If I remove {{super()}}, I get $ is not defined, followed by jquery is not defined.

What am I doing wrong? I want to include jquery and underscore in my custom RTD theme.

PhantomRwcwride2Zero commented 1 year ago

Just want to let you know this will not be anymore because trouble found them and they won't be able to do this ever again because of the bad they was doing with this you should never take what is not yours because it will catch up to you every time.

Randy

On Sun, Aug 13, 2023, 2:11 PM kapooramit @.***> wrote:

I am trying to follow the instruction to include jquery.js in the layout.html by adding the following lines to the layout.html in the .

{%- block scripts %}

<script src="{{ pathto('_static/underscore.js', resource=True) }}"></script>
{{ super() }}

{%- endblock %}

[https://github.com/sphinx-doc/sphinx/issues/7405 https://github.com/sphinx-doc/sphinx/issues/7405]

However, the above code causes the output HTML to throw the double script block error. If I remove {{super()}}, I get $ is not defined, followed by jquery is not defined.

What am I doing wrong? I want to include jquery and underscore in the custom RTD theme.

— Reply to this email directly, view it on GitHub https://github.com/readthedocs/sphinx_rtd_theme/issues/1501, or unsubscribe https://github.com/notifications/unsubscribe-auth/A34DZVDXIZZ6URXGDW7JFP3XVEKEZANCNFSM6AAAAAA3OZPJQQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kapooramit commented 1 year ago

@nienn : Can you suggest?

humitos commented 1 year ago

What am I doing wrong? I want to include jquery and underscore in my custom RTD theme.

Read the Docs theme already includes jQuery. You should only include underscore on yours.