how to list a posts list without current post in a blog post.

SOLVE
Highlighted
Regular Contributor

i want to list a blog posts list on a single post page, and dynamic list out current post on list. 

螢幕快照 2020-02-15 下午2.11.27.png

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Esteemed Contributor | Diamond Partner
{% set rec_posts = blog_recent_posts('default', 5) %}
{% for blog_post in rec_posts %}
    {% if blog_post.absolute_url != request.full_url %}
YOUR CONTENT HERE {% endif %} {% endfor %}

 You can use an if statement inside your listing loop to check the current loops' url against the current post page's url. 

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!

2 Replies 2
Esteemed Contributor | Diamond Partner
{% set rec_posts = blog_recent_posts('default', 5) %}
{% for blog_post in rec_posts %}
    {% if blog_post.absolute_url != request.full_url %}
YOUR CONTENT HERE {% endif %} {% endfor %}

 You can use an if statement inside your listing loop to check the current loops' url against the current post page's url. 

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!

Regular Contributor

Thank you. i've solved it. and also i've tried other way is same worked.螢幕快照 2020-02-15 下午3.52.16.png