Redirecting jekyll site to https
A quick jekyll tip:
To redirect any page in the jekyll site to https, use the following code in head.html include.
With jekyll serve
, the https redirect is not used since the server
doesn’t use https.
{% if site.url contains "localhost" %}
<!-- left out https redirect -->
{% else %}
<script>
if (window.location.protocol == 'http:') {
window.location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
}
</script>
{% endif %}