Mercurial > p > roundup > code
comparison website/www/_templates/layout.html @ 6771:c574d888dd87
Improve perf: css/js to end; templating for goatcounter src
Lighthouse reports a lot of time was spent waiting for js and css to
load before page could be shown. Especially for customizing.html.
Keep style.css in head, but move pygments.css to end of body.
(note, lighthouse was reporting that contrast for pygments wasn;t as
high as it should be.)
Also move the 4 js files: jquery, underscore.js, doctools.js
language_data.js to the end of body.
Move the js script that shows the searchbox there too as it uses
jquery.
Use the templating pathto() function to generate path to goatcounter
js file.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 11 Jul 2022 00:56:47 -0400 |
| parents | 54af7ce65e6e |
| children | e7b4ad2c57ac |
comparison
equal
deleted
inserted
replaced
| 6770:c645f51e9e8a | 6771:c574d888dd87 |
|---|---|
| 17 {%- for link, type, title in page_links %} | 17 {%- for link, type, title in page_links %} |
| 18 <link rel="alternate" type="{{ type|e(true) }}" title="{{ title|e(true) }}" href="{{ link|e(true) }}" /> | 18 <link rel="alternate" type="{{ type|e(true) }}" title="{{ title|e(true) }}" href="{{ link|e(true) }}" /> |
| 19 {%- endfor %} | 19 {%- endfor %} |
| 20 {%- else %} | 20 {%- else %} |
| 21 <link rel="stylesheet" href="{{ pathto('_static/style.css', 1) }}" type="text/css" /> | 21 <link rel="stylesheet" href="{{ pathto('_static/style.css', 1) }}" type="text/css" /> |
| 22 <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> | |
| 23 | 22 |
| 24 {%- endif %} | 23 {%- endif %} |
| 25 {%- if builder != 'htmlhelp' %} | 24 {%- if builder != 'htmlhelp' %} |
| 26 <script type="text/javascript"> | 25 <script type="text/javascript"> |
| 27 var DOCUMENTATION_OPTIONS = { | 26 var DOCUMENTATION_OPTIONS = { |
| 29 VERSION: '{{ release|e }}', | 28 VERSION: '{{ release|e }}', |
| 30 COLLAPSE_MODINDEX: false, | 29 COLLAPSE_MODINDEX: false, |
| 31 FILE_SUFFIX: '{{ file_suffix }}' | 30 FILE_SUFFIX: '{{ file_suffix }}' |
| 32 }; | 31 }; |
| 33 </script> | 32 </script> |
| 34 {%- for scriptfile in script_files %} | |
| 35 <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script> | |
| 36 {%- endfor %} | |
| 37 {%- if pageurl %} | 33 {%- if pageurl %} |
| 38 <link rel="canonical" href="{{ pageurl|e }}" /> | 34 <link rel="canonical" href="{{ pageurl|e }}" /> |
| 39 {%- endif %} | 35 {%- endif %} |
| 40 {%- if use_opensearch %} | 36 {%- if use_opensearch %} |
| 41 <link rel="search" type="application/opensearchdescription+xml" | 37 <link rel="search" type="application/opensearchdescription+xml" |
| 78 <input type="submit" value="{{ _('Search') }}" /> | 74 <input type="submit" value="{{ _('Search') }}" /> |
| 79 <input type="hidden" name="check_keywords" value="yes" /> | 75 <input type="hidden" name="check_keywords" value="yes" /> |
| 80 <input type="hidden" name="area" value="default" /> | 76 <input type="hidden" name="area" value="default" /> |
| 81 </form> | 77 </form> |
| 82 </div> | 78 </div> |
| 83 <script type="text/javascript">$('#searchbox').show(0);</script> | |
| 84 {%- endif %} | 79 {%- endif %} |
| 85 </div> | 80 </div> |
| 86 <div class="navigation"> | 81 <div class="navigation"> |
| 87 <div class="menu"> | 82 <div class="menu"> |
| 88 {{ toctree() }} | 83 {{ toctree() }} |
| 121 {%- endif %} | 116 {%- endif %} |
| 122 <span>Hosted by <a href="https://sourceforge.net"><img src="https://sflogo.sourceforge.net/sflogo.php?group_id=31577&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a></span> | 117 <span>Hosted by <a href="https://sourceforge.net"><img src="https://sflogo.sourceforge.net/sflogo.php?group_id=31577&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a></span> |
| 123 </div> | 118 </div> |
| 124 </div> | 119 </div> |
| 125 {%- endblock %} | 120 {%- endblock %} |
| 121 <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> | |
| 126 <script> | 122 <script> |
| 127 /* locally hosted goatcounter https://www.goatcounter.com/ */ | 123 /* locally hosted goatcounter https://www.goatcounter.com/ */ |
| 128 /* include site info in path url to allow multiple sites to be | 124 /* include site info in path url to allow multiple sites to be |
| 129 tracked together */ | 125 tracked together */ |
| 130 window.goatcounter = { | 126 window.goatcounter = { |
| 131 path: function(p) { return location.host + p } | 127 path: function(p) { return location.host + p } |
| 132 } | 128 } |
| 133 </script> | 129 </script> |
| 134 <script data-goatcounter="https://stats.rouilj.dynamic-dns.net/count" | 130 <script data-goatcounter="https://stats.rouilj.dynamic-dns.net/count" |
| 135 integrity="sha384-QGgNMMRFTi8ul5kHJ+vXysPe8gySvSA/Y3rpXZiRLzKPIw8CWY+a3ObKmQsyDr+a" | 131 integrity="sha384-QGgNMMRFTi8ul5kHJ+vXysPe8gySvSA/Y3rpXZiRLzKPIw8CWY+a3ObKmQsyDr+a" |
| 136 async="" src="_static/goatcounter_count.v3.js"> | 132 async="" src="{{ pathto('_static/goatcounter_count.v3.js', 1) }}"> |
| 137 </script> | 133 </script> |
| 134 {%- for scriptfile in script_files %} | |
| 135 <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script> | |
| 136 {%- endfor %} | |
| 137 <script type="text/javascript">$('#searchbox').show(0);</script> | |
| 138 </body> | 138 </body> |
| 139 </html> | 139 </html> |
