Created
August 24, 2017 16:26
-
-
Save mrmanc/7065c8c219dd9ca6552184f24c88069a to your computer and use it in GitHub Desktop.
WIP to create a directory structure in a list for a Jekyll site
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 level = 0 %} | |
{% assign previous_level = 1 %} | |
{% assign sorted_pages = site.pages | sort:'url' %} | |
{% for page in sorted_pages %} | |
{% assign level = page.dir | split:"/" | size | minus:1 %} | |
{% if level > previous_level %} | |
<ul> | |
{% elsif level < previous_level %} | |
</ul> | |
{% endif %} | |
<li><a href="{{page.url}}">{{page.dir | split:"/" | last | replace:'-',' ' }}</a></li> | |
{% assign previous_level = level %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment