Using blog_recent_topic_posts() to Exclude Current Post in Returned Results
lösung
Hi,
I created a recent posts module for the bottom of my blog to pull in the three most recent posts from the same topic as the present post. I like the way it's working, but... the first post is the current post.
So is there a way to add in an offset to take posts #2, #3 and #4 and/or exlcude the current post?
Here's the gist of the module:
{% set number_of_posts = 3 %}
{% set posts = blog_recent_topic_posts("default", content.topic_list[0].slug, 3) %}
{% if module.specific_tag_topic %}
{% set posts = blog_recent_topic_posts(module.choose_blog, module.tag, number_of_posts) %}
{% endif %}
<section class="blog-feed">
<div>
<h2>
Related Reading
</h2>
</div>
<div class="blog-posts">
{% for post in posts %}
<div class="blog-post">
<div class="ni-post blog-post-inner">
<div class="blog-post-image" style="background-image: url({{ resize_image_url( post.featured_image,0,350 ) }});"></div>
<div class="blog-post-content-wrapper">
<a class="blog-post-title" href="{{ post.absolute_url }}"><h3>{{ post.name }}</h3></a>
<a class="blog-post-read-more" href="{{ post.absolute_url }}">Read More →</a>
</div>
</div>
</div>
{% endfor %}
</div>
</section>