Forcing CSS and Javascript to be loaded via HTTPS.
authorGreg Wilson <gvwilson@third-bit.com>
Thu, 21 Jul 2016 00:01:47 +0000 (20:01 -0400)
committerGreg Wilson <gvwilson@third-bit.com>
Thu, 21 Jul 2016 00:01:47 +0000 (20:01 -0400)
Using `site.github.url` to refer to the repository fails to load resources when the GitHub Pages site is accessed via HTTPS, because `site.github.url` is `http` protocol.  This modifies loads of CSS and Javascript files to always use `https`.

_includes/javascript.html
_layouts/base.html
_layouts/workshop.html

index c2d678c4e52a6812fdac240be4cc7f7af41f1ebf..ccf0a887a0ebd831b47c86be69e25277ebd33366 100644 (file)
@@ -1,3 +1,3 @@
-<script src="{{ site.github.url }}/assets/js/jquery.min.js"></script>
-<script src="{{ site.github.url }}/assets/js/bootstrap.min.js"></script>
-<script src="{{ site.github.url }}/assets/js/lesson.js"></script>
+<script src="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/js/jquery.min.js"></script>
+<script src="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/js/bootstrap.min.js"></script>
+<script src="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/js/lesson.js"></script>
index 2efa93a11ba15ded14bd44e6b7a3e4e7a6411e17..20ce747ff4700626971da60e44f9631029610fa8 100644 (file)
@@ -7,10 +7,10 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta http-equiv="last-modified" content="{{ site.time }}">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-    <meta name="search-domain" value="{{ site.github.url }}">
-    <link rel="stylesheet" type="text/css" href="{{ site.github.url }}/assets/css/bootstrap.css" />
-    <link rel="stylesheet" type="text/css" href="{{ site.github.url }}/assets/css/bootstrap-theme.css" />
-    <link rel="stylesheet" type="text/css" href="{{ site.github.url }}/assets/css/lesson.css" />
+    <meta name="search-domain" value="{{ site.github.url | replace_first: 'http:', 'https:' }}">
+    <link rel="stylesheet" type="text/css" href="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/css/bootstrap.css" />
+    <link rel="stylesheet" type="text/css" href="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/css/bootstrap-theme.css" />
+    <link rel="stylesheet" type="text/css" href="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/css/lesson.css" />
     {% if site.carpentry == "swc" %}
     <link rel="shortcut icon" type="image/x-icon" href="/favicon-swc.ico" />
     {% endif %}
index b9367e0029e5137a616a3c7748736660fa61df2f..d52ee6246c86b694bf9693e5515681ef72e3e3df 100644 (file)
@@ -25,9 +25,9 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta http-equiv="last-modified" content="{{ site.time }}">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-    <link rel="stylesheet" type="text/css" href="{{ site.github.url }}/assets/css/bootstrap.css" />
-    <link rel="stylesheet" type="text/css" href="{{ site.github.url }}/assets/css/bootstrap-theme.css" />
-    <link rel="stylesheet" type="text/css" href="{{ site.github.url }}/assets/css/lesson.css" />
+    <link rel="stylesheet" type="text/css" href="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/css/bootstrap.css" />
+    <link rel="stylesheet" type="text/css" href="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/css/bootstrap-theme.css" />
+    <link rel="stylesheet" type="text/css" href="{{ site.github.url | replace_first: 'http:', 'https:' }}/assets/css/lesson.css" />
     {% if site.carpentry == "swc" %}
     <link rel="shortcut icon" type="image/x-icon" href="/favicon-swc.ico" />
     {% endif %}