Last active
June 2, 2024 21:25
-
-
Save Ketrel/1f36fca6b4148f7263b3ee8fdb0923e7 to your computer and use it in GitHub Desktop.
Relative url base for jekyll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign relBase = '' %} | |
{% assign tempDepth = page.url | append: 'hackish-solution' | split: '/' | size | minus: 2 %} | |
{% for i in (1..tempDepth) %} | |
{% assign relBase = relBase | append: "../" %} | |
{% endfor %} | |
{% if relBase == '' %} | |
{% assign relBase = './' %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@agowa this is not a layout. put it in
_includes
and call it in your layout. https://jekyllrb.com/docs/includes/