Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugoThemesSite.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-18 13:28:49 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-18 13:36:15 +0300
commitedaa008f38dfa6109c526cc36ab187ebc3b67c2a (patch)
treed82187ebd6494d9f2347985ac25707a4ad4afbea
parentcf7526dbba1f201fec6f4b63d57cb79244f2cb2a (diff)
Redirect to https if http and in production
We should probably do this on DNS level, but that decission is locked for 1 year, so one has to be very sure that it doesn't have any unintended side-effects. The problem with supporting both is: * Twitter does not like schema-less URLs in images in their cards * Some theme demos does not like a mix of http and https Fixes https://github.com/gohugoio/hugoThemes/issues/268
-rw-r--r--layouts/partials/head-additions.html10
1 files changed, 9 insertions, 1 deletions
diff --git a/layouts/partials/head-additions.html b/layouts/partials/head-additions.html
index 8623866..1a90f41 100644
--- a/layouts/partials/head-additions.html
+++ b/layouts/partials/head-additions.html
@@ -21,4 +21,12 @@
opacity: 1;
transition: opacity 300ms;
}
-</style> \ No newline at end of file
+</style>
+{{ if eq (getenv "HUGO_ENV") "production" }}
+<script type="text/javascript">
+var loc = window.location.href+'';
+if (loc.indexOf('http://')==0){
+ window.location.href = loc.replace('http://','https://');
+}
+</script>
+{{ end }}