Optimize Website Load Time (#435)
* Place js files after body tag * Add Analytics to the end of script * Minor nits and fixes Co-authored-by: Maruan Al-Shedivat <alshedivat.maruan@gmail.com>
This commit is contained in:
parent
696894549b
commit
9c36be1320
@ -42,33 +42,3 @@
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ '/assets/css/main.css' | relative_url }}">
|
||||
<link rel="canonical" href="{{ page.url | replace:'index.html','' | relative_url }}">
|
||||
|
||||
<!-- JQuery -->
|
||||
{% include scripts/jquery.html %}
|
||||
|
||||
<!-- Theming-->
|
||||
{% if site.enable_darkmode %}
|
||||
<script src="{{ '/assets/js/theme.js' | relative_url }}"></script>
|
||||
<script src="{{ '/assets/js/dark_mode.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_google_analytics %}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ site.google_analytics }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_panelbear_analytics %}
|
||||
<!-- Panelbear Analytics - We respect your privacy -->
|
||||
<script async src="https://cdn.panelbear.com/analytics.js?site={{site.panelbear_analytics}}"></script>
|
||||
<script>
|
||||
window.panelbear = window.panelbear || function() { (window.panelbear.q = window.panelbear.q || []).push(arguments); };
|
||||
panelbear('config', { site: '{{site.panelbear_analytics}}' });
|
||||
</script>
|
||||
{% endif %}
|
||||
|
21
_includes/scripts/analytics.html
Normal file
21
_includes/scripts/analytics.html
Normal file
@ -0,0 +1,21 @@
|
||||
{% if site.enable_google_analytics %}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ site.google_analytics }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if site.enable_panelbear_analytics %}
|
||||
<!-- Panelbear Analytics - We respect your privacy -->
|
||||
<script async src="https://cdn.panelbear.com/analytics.js?site={{site.panelbear_analytics}}"></script>
|
||||
<script>
|
||||
window.panelbear = window.panelbear || function() { (window.panelbear.q = window.panelbear.q || []).push(arguments); };
|
||||
panelbear('config', { site: '{{site.panelbear_analytics}}' });
|
||||
</script>
|
||||
{% endif %}
|
@ -1,3 +1,9 @@
|
||||
{% if site.enable_darkmode %}
|
||||
<!-- Dark Mode -->
|
||||
<script src="{{ '/assets/js/theme.js' | relative_url }}"></script>
|
||||
<script src="{{ '/assets/js/dark_mode.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_tooltips %}
|
||||
<!-- Enable Tooltips -->
|
||||
<script type="text/javascript">
|
||||
|
@ -4,7 +4,6 @@
|
||||
<head>
|
||||
{% if page.redirect %}<meta http-equiv="refresh" content="3; url={{ site.baseurl | prepend: site.url }}/" />{% endif %}
|
||||
{% include head.html %}
|
||||
{% include scripts/mathjax.html %}
|
||||
</head>
|
||||
|
||||
<body class="{% if site.navbar_fixed %}fixed-top-nav{% endif %} {% unless site.footer_fixed %}sticky-bottom-footer{% endunless %}">
|
||||
@ -25,8 +24,11 @@
|
||||
|
||||
</body>
|
||||
|
||||
{% include scripts/jquery.html %}
|
||||
{% include scripts/bootstrap.html %}
|
||||
{% include scripts/mansory.html %}
|
||||
{% include scripts/misc.html %}
|
||||
{% include scripts/mathjax.html %}
|
||||
{% include scripts/analytics.html %}
|
||||
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user