From 3adf21ea3caa3e7e768adc4920170ec6ba028eb8 Mon Sep 17 00:00:00 2001 From: Lucas Amaro <lucasrla@users.noreply.github.com> Date: Wed, 9 Mar 2022 09:40:06 -0300 Subject: [PATCH] Update shynet logic on redirects --- _layouts/redirect.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/_layouts/redirect.html b/_layouts/redirect.html index 1a742da..7205998 100644 --- a/_layouts/redirect.html +++ b/_layouts/redirect.html @@ -28,8 +28,19 @@ <h1>Redirecting …</h1> </p> {% if jekyll.environment != "local" and site.shynet %} - <noscript><img src="{{ site.shynet }}/pixel.gif"></noscript> - <script src="{{ site.shynet }}/script.js"></script> + + {% comment %} This is to prevent double slashes "//" {% endcomment %} + {% assign shynet_last_char = site.shynet | slice: -1 %} + + {% if shynet_last_char == "/" %} + {% assign new_length = site.shynet | size | minus: 1 %} + {% assign shynet = site.shynet | slice: 0, new_length %} + {% else %} + {% assign shynet = site.shynet %} + {% endif %} + + <noscript><img src="{{ shynet }}/pixel.gif"></noscript> + <script src="{{ shynet }}/script.js"></script> {% endif %} </body>