Adding Javascript to layout.html template in Sphinx

تبليغ
سؤال

يرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.

تبليغ
‎إلغاء

I’m extending the layout of my sphinx-book-theme by adding the following to the layout.htmlunder my source_templatesfolder:

{% extends “!layout.html” %}

{%- block extrahead %}
<script
type=”text/javascript”
src=”https://utteranc.es/client.js”
async=”async”
repo=”executablebooks/jupyter-book”
issue-term=”pathname”
theme=”github-light”
label=”💬 comment”
crossorigin=”anonymous”>
</script>

{% endblock %}

When I build from source with the command:

sphinx-build -b html ….

The html output doesn’t render the comment section at the bottom of the pages.

However, if I add the javascript bloc directly to the bottom of a Markdown file, the comment section appears at the bottom of the relevant page.

What am I missing here? When I inspect the page source, I can see that the javascript block is in the head section.

I’m using Sphinx v4.5.0 with the Sphinx-book-theme on a Windows OS

‫أضف إجابة

تصفح
تصفح

مجهول يجيب