diff doc/_templates/layout.html @ 7751:bd013590d8d6

docs: optimize head section of templates Reordered the head section of website/www using capo.js to improve speed. Tried to do the same for the doc/_template/layout.html. Due to a bug in sphinx, we get duplicate viewport tags. https://github.com/sphinx-doc/sphinx/issues/11699 but I think it's harmless.
author John Rouillard <rouilj@ieee.org>
date Fri, 01 Mar 2024 14:07:28 -0500
parents 291afa77ad82
children 7ac637506acf
line wrap: on
line diff
--- a/doc/_templates/layout.html	Fri Mar 01 14:04:05 2024 -0500
+++ b/doc/_templates/layout.html	Fri Mar 01 14:07:28 2024 -0500
@@ -105,24 +105,10 @@
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-    {%- if 'name="description"' not in metatags %}
-      <meta name="description"
-        content="Page {{ pagename }} in documentation on the Roundup issue tracker, version {{ release|e }}.">
-    {%- endif %}
-    {{ metatags }}
     {%- if builder != 'htmlhelp' %}
       {%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
     {%- endif %}
     <title>{{ title|striptags }}{{ titlesuffix }}</title>
-    {%- if builder == 'web' %}
-    <link rel="stylesheet" href="{{ pathto('index') }}?do=stylesheet{%
-      if in_admin_panel %}&admin=yes{% endif %}" type="text/css" />
-    {%- for link, type, title in page_links %}
-    <link rel="alternate" type="{{ type|e(true) }}" title="{{ title|e(true) }}" href="{{ link|e(true) }}" />
-    {%- endfor %}
-    {%- else %}
-    {{ css() }}
-    {%- endif %}
     {%- if builder != 'htmlhelp' %}
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
@@ -135,6 +121,22 @@
     {%- for scriptfile in script_files %}
     <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
     {%- endfor %}
+    {%- if builder == 'web' %}
+    <link rel="stylesheet" href="{{ pathto('index') }}?do=stylesheet{%
+      if in_admin_panel %}&admin=yes{% endif %}" type="text/css" />
+    {%- for link, type, title in page_links %}
+    <link rel="alternate" type="{{ type|e(true) }}" title="{{ title|e(true) }}" href="{{ link|e(true) }}" />
+    {%- endfor %}
+    {%- else %}
+    {{ css() }}
+    {%- endif %}
+    <!-- https://github.com/sphinx-doc/sphinx/issues/11699 means a
+         duplicate viewport tag -->
+    {{ metatags }}
+    {%- if 'name="description"' not in metatags %}
+      <meta name="description"
+        content="Page {{ pagename }} in documentation on the Roundup issue tracker, version {{ release|e }}.">
+    {%- endif %}
     {%- if use_opensearch %}
     <link rel="search" type="application/opensearchdescription+xml"
           title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"

Roundup Issue Tracker: http://roundup-tracker.org/