Redirecting zola site to https

A quick zola tip:

To redirect any page in the zola site to https, use the following code in head.html include.

With zola serve, the https redirect is not used since the server doesn't use https.

{% if current_url %}
{% if current_url is containing("127.0.0.1") %}
<!-- left out https redirect -->
{% else %}
<script>
if (window.location.protocol == 'http:') {
  location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
}
</script>
{% endif %}
{% endif %}
Top