Skip to content

Commit

Permalink
Update shynet logic on redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasrla committed Mar 9, 2022
1 parent f2a1d31 commit 3adf21e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions _layouts/redirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,19 @@ <h1>Redirecting &hellip;</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>

Expand Down

0 comments on commit 3adf21e

Please sign in to comment.