CMS Development

victorwu
Participant

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

SOLVE

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

0 Upvotes
1 Accepted solution
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

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

SOLVE
{% 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. 

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

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

2 Replies 2
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

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

SOLVE
{% 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. 

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

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
victorwu
Participant

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

SOLVE

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