Exclude javascript parts into own file
This commit is contained in:
parent
f1e0ff2fc1
commit
9c7c6a7652
3 changed files with 20 additions and 21 deletions
|
@ -16,5 +16,7 @@
|
||||||
{{ partial "footer.html" . }}
|
{{ partial "footer.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ partial "javascript.html" . }}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -21,24 +21,3 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|
||||||
<!-- JavaScript -->
|
|
||||||
{{ $main := resources.Get "js/main.js" }}
|
|
||||||
{{ $menu := resources.Get "js/menu.js" }}
|
|
||||||
{{ $prism := resources.Get "js/prism.js" }}
|
|
||||||
{{ $theme := resources.Get "js/theme.js" }}
|
|
||||||
{{ $js := slice $main $menu $prism $theme | resources.Concat "js/bundle.js" }}
|
|
||||||
{{ $secureJS := $js | resources.Fingerprint "sha512" }}
|
|
||||||
<script type="text/javascript" src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
|
|
||||||
|
|
||||||
{{- if .Site.GoogleAnalytics }}
|
|
||||||
<script>
|
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
||||||
ga('create', '{{.Site.GoogleAnalytics}}', 'auto');
|
|
||||||
ga('send', 'pageview');
|
|
||||||
</script>
|
|
||||||
{{- end}}
|
|
||||||
|
|
18
layouts/partials/javascript.html
Normal file
18
layouts/partials/javascript.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{{ $main := resources.Get "js/main.js" }}
|
||||||
|
{{ $menu := resources.Get "js/menu.js" }}
|
||||||
|
{{ $prism := resources.Get "js/prism.js" }}
|
||||||
|
{{ $theme := resources.Get "js/theme.js" }}
|
||||||
|
{{ $js := slice $main $menu $prism $theme | resources.Concat "js/bundle.js" }}
|
||||||
|
{{ $secureJS := $js | resources.Fingerprint "sha512" }}
|
||||||
|
<script type="text/javascript" src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
|
||||||
|
|
||||||
|
{{- if .Site.GoogleAnalytics }}
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
ga('create', '{{.Site.GoogleAnalytics}}', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
</script>
|
||||||
|
{{- end}}
|
Loading…
Add table
Add a link
Reference in a new issue