Skip to content

Instantly share code, notes, and snippets.

@jasonhodges
Forked from KevinGimbel/loop.html
Created January 3, 2014 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonhodges/8248823 to your computer and use it in GitHub Desktop.
Save jasonhodges/8248823 to your computer and use it in GitHub Desktop.
<!-- the standard loop for all your posts -->
{% for post in site.posts %}
<!-- check if there is a portfolio thing set inside the Front Matter
Note: Do not set "portfolio: false" on normal posts - this is not needed
and could lead to problems
-->
{% if post.portfolio %}
<!-- do nothing here -->
{% endif %}
<!-- then display all the normal posts -->
<article class="post">
<h2>{{ post.titl }}</h2>
{{ post.excerpt }}
</aticle>
{% endfor %}
title layout
I'm not a Portfolio Item!
post

Lorem Ipsum Dolor

Just do not write "portfolio" inside the Front Matter. That's it.

title layout portfolio
I'm a Portfolio Item!
portfolio
true

Lorem Ipsum Dolor

{% for post in site.posts %}
<!-- again we loop through the posts, because technically the Portfolio Stuff is a post -->
<!-- this time we only want posts where portfolio is true (or set at all) -->
{% if post.portfolio %}
<article class="portfolio--article">
<!-- the title-->
<h2>{{ post.title }}</h2>
<!-- the content -->
<p>{{ post.content }}</p>
</article>
{% endif%} <!-- end of every post that has portfolio: true -->
{% endfor %} <!-- end of the loop -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment