Created
January 8, 2014 03:21
-
-
Save oneblackcrayon/8311250 to your computer and use it in GitHub Desktop.
This is how you loop through different directories in Jekyll using Liquid. I searched through about 50 pages on Stack Overflow, NationBuilder, and GitHub. There should be better documentation on JekyllRB.com for this kind of stuff. You can change the page.layout to be anything in your page's front-matter (the stuff that starts and ends with the …
This file contains hidden or 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
{% case page.layout %} | |
{% when 'page' %} | |
{% for page in site.pages %} | |
{% if page.layout == 'page' %} | |
{% if page.title != 'Home' %} | |
<a href="{{ page.url }}">{{ page.title }}</a> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
{% when 'app' %} | |
{% for page in site.pages %} | |
{% if page.layout == 'app' %} | |
{% if page.title != 'Home' %} | |
<a href="{{ page.url }}">{{ page.title }}</a> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
{% when 'default' %} | |
{% for page in site.pages %} | |
{% if page.title != 'Home' %} | |
<a href="{{ page.url }}">{{ page.title }}</a> | |
{% endif %} | |
{% endfor %} | |
{% else %} | |
{% endcase %} |
I wrote this years ago.
Does it still work?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much for your work and for sharing it!