TRIQS / triqs

a Toolbox for Research on Interacting Quantum Systems
https://triqs.github.io
GNU General Public License v3.0
135 stars 71 forks source link

[doc] `layout.html` is incompatible with Sphinx>=6.0.0 #912

Closed krivenko closed 11 months ago

krivenko commented 11 months ago

I am getting a theme error when trying to build the docs with Sphinx 7.2.5

Theme error:
An error happened in rendering the page ChangeLog.
Reason: UndefinedError("'logo' is undefined")

Is appears that Sphinx 6.0.0 renamed the logo variable in HTML templates and now it is called logo_url.

The offending HTML fragment is

https://github.com/TRIQS/triqs/blob/e1fa5dd2c8984e334574163f6323e956a49ffbd5/doc/_templates/layout.html#L11-L13

Since layout.html is based on some code from sphinx_rtd_theme, I suggest doing the same thing as RTD's devs did,

+{%- set _logo_url = logo_url|default(pathto('_static/' + (logo or ""), 1)) %}
 <a href={{ pathto('index') }}>
-  <img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
+  <img src="{{ _logo_url }}" class="logo" alt="{{ _('Logo') }}"/>
 </a>

With this change, the documentation builds normally and the logo is properly displayed.

Wentzell commented 11 months ago

Thank you @krivenko for pointing this out. This was fixed in 873e425be