Reputation: 41
My code is:
<div class="recent-posts">
{% for post in site.posts | limit:3 %}
<div class="recent-posts-inline">
{% if post.featured-image %}{% include post-featured-image.html image=post.featured-image alt=page.featured-image-alt %}{% endif %}
<h4>
<a href="{{ post.url }}">{{ post.title }}</a>
</h4>
<p>{{ post.excerpt | strip_html | strip_newlines | truncate: 156 }}</p>
<p><a href="{{ post.url }}">Read More...</a></p>
</div>
{% endfor %}
</div>
I have tried using where_exp filter but to no avail. That's why I have to ask this question again.
Upvotes: 1
Views: 215
Reputation: 1396
Use the page variable in an if-check. Only do something if the post is not the same title as the current page. If you want a different comparison, you can check the .url
, .id
, or .name
.
<div class="recent-posts">
{% for post in site.posts | limit:3 %}
{% if post.title != page.title %}
<div class="recent-posts-inline">
...
{% endif %}
{% endfor %}
</div>
Upvotes: 2