Skip to content

Instantly share code, notes, and snippets.

@allejo
Created September 11, 2017 22:56
Show Gist options
  • Save allejo/ecb37c143cedf9f569612d68984534ad to your computer and use it in GitHub Desktop.
Save allejo/ecb37c143cedf9f569612d68984534ad to your computer and use it in GitHub Desktop.
{% assign base = '' %}
{% assign depth = page.url | split: '/' | size | minus: 1 %}
{% if depth <= 1 %}
{% assign base = '.' %}
{% else %}
{% for d in (1..depth) %}
{% assign base = base | append: '..' %}
{% unless forloop.last %}
{% assign base = base | append: '/' %}
{% endunless %}
{% endfor %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment