Reputation: 6302
I am using Jekyll as a static generator for a website (not a blog), and I want to have an automatically generated list of all pages on my index page. I get that to work with the following code for the sidebar.html
file:
<ul>
{% for page in site.pages %}
<li><div class="drvce"><a href="{{ page.url }}">{{ page.title }}</a></div></li>
{% endfor %}
</ul>
Now I would like that the index page is not shown in that list. Is there a way to do that?
Upvotes: 0
Views: 112
Reputation: 1
If it's your main index page that you don't want to show up try this:
<ul>
{% for page in site.pages and page.url != "/" %}
<li><div class="drvce"><a href="{{ page.url }}">{{ page.title }}</a></div></li>
{% endfor %}
</ul>
Upvotes: 0
Reputation: 37065
I have never used jekyll, but it's main page says that it uses Liquid, and according to their docs, I think the following should work:
<ul>
{% for page in site.pages %}
{% if page.title != 'index' %}
<li><div class="drvce"><a href="{{ page.url }}">{{ page.title }}</a></div></li>
{% endif %}
{% endfor %}
</ul>
Upvotes: 3
Reputation: 71
I can offer you a jquery solution
add this in your <head></head>
tag
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
add this after </ul>
<script> $('ul li:first').remove(); </script>
Upvotes: 0