Exclude javascript parts into own file
This commit is contained in:
parent
e8e96b0f69
commit
2b3d377245
|
@ -16,5 +16,7 @@
|
|||
{{ partial "footer.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ partial "javascript.html" . }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -21,24 +21,3 @@
|
|||
</div>
|
||||
</div>
|
||||
</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}}
|
||||
|
|
|
@ -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…
Reference in New Issue