summaryrefslogtreecommitdiffhomepage
path: root/layouts/partials
diff options
context:
space:
mode:
authorIan Lewis <ianmlewis@gmail.com>2019-05-30 04:20:12 -0400
committerIan Lewis <ianlewis@google.com>2019-05-31 08:15:32 +0900
commitd480bf388918944d322a499f3dbbd51f7e977b82 (patch)
tree8feea97a105b6a2e3a834f0285f7ead1fde98696 /layouts/partials
parentb532e65552a6035a827b5df28aaaee4d003c420e (diff)
Serve all javascript from gvisor.dev
For security & privacy reasons, serve javascript from gvisor.dev instead of using external CDNs.
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/head.html10
-rw-r--r--layouts/partials/scripts.html12
2 files changed, 14 insertions, 8 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 47c205a2f..1587dbddc 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -20,12 +20,6 @@
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
{{ partialCached "head-css.html" . "asdf" }}
-<script
- src="https://code.jquery.com/jquery-3.3.1.min.js"
- integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
- crossorigin="anonymous"></script>
-<script
- src="https://d3js.org/d3.v4.min.js"
- integrity="sha384-1EOYqz4UgZkewWm70NbT1JBUXSQpOIS2AaJy6/evZH+lXOrt9ITSJbFctNeyBoIJ"
- crossorigin="anonymous"></script>
+<script src="/js/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
+<script src="/js/d3.v4.min.js" integrity="sha384-1EOYqz4UgZkewWm70NbT1JBUXSQpOIS2AaJy6/evZH+lXOrt9ITSJbFctNeyBoIJ" crossorigin="anonymous"></script>
{{ partial "hooks/head-end.html" . }}
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
new file mode 100644
index 000000000..b6f9696d3
--- /dev/null
+++ b/layouts/partials/scripts.html
@@ -0,0 +1,12 @@
+<script src="/js/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
+<script src="/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
+{{ $jsBase := resources.Get "js/base.js" }}
+{{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" .Site.Home }}
+{{ $js := (slice $jsBase $jsSearch) | resources.Concat "js/main.js" }}
+{{ if .Site.IsServer }}
+<script src="{{ $js.RelPermalink }}"></script>
+{{ else }}
+{{ $js := $js | minify | fingerprint }}
+<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
+{{ end }}
+{{ partial "hooks/body-end.html" . }}