Mercurial > p > roundup > code
changeset 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 | c645f51e9e8a |
| children | fde9fe504ebd |
| files | website/www/_templates/layout.html |
| diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/website/www/_templates/layout.html Mon Jul 11 00:49:18 2022 -0400 +++ b/website/www/_templates/layout.html Mon Jul 11 00:56:47 2022 -0400 @@ -19,7 +19,6 @@ {%- endfor %} {%- else %} <link rel="stylesheet" href="{{ pathto('_static/style.css', 1) }}" type="text/css" /> - <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> {%- endif %} {%- if builder != 'htmlhelp' %} @@ -31,9 +30,6 @@ FILE_SUFFIX: '{{ file_suffix }}' }; </script> - {%- for scriptfile in script_files %} - <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script> - {%- endfor %} {%- if pageurl %} <link rel="canonical" href="{{ pageurl|e }}" /> {%- endif %} @@ -80,7 +76,6 @@ <input type="hidden" name="area" value="default" /> </form> </div> - <script type="text/javascript">$('#searchbox').show(0);</script> {%- endif %} </div> <div class="navigation"> @@ -123,6 +118,7 @@ </div> </div> {%- endblock %} + <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> <script> /* locally hosted goatcounter https://www.goatcounter.com/ */ /* include site info in path url to allow multiple sites to be @@ -133,7 +129,11 @@ </script> <script data-goatcounter="https://stats.rouilj.dynamic-dns.net/count" integrity="sha384-QGgNMMRFTi8ul5kHJ+vXysPe8gySvSA/Y3rpXZiRLzKPIw8CWY+a3ObKmQsyDr+a" - async="" src="_static/goatcounter_count.v3.js"> + async="" src="{{ pathto('_static/goatcounter_count.v3.js', 1) }}"> </script> + {%- for scriptfile in script_files %} + <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script> + {%- endfor %} + <script type="text/javascript">$('#searchbox').show(0);</script> </body> </html>
