Forum

Thread tagged as: Question, Blog

Exclude Current Post

Hi there,

I'm creating a blog post that showcases the latest blog items in the sidebar, which is easy enough by copying the the post_in_list.html template.

But what i was wondering is, if the user is in reading a blog post is there a way to exclude that post from the list in the sidebar?

Many thanks,

Cameron Duthie

Cameron Duthie 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you just need to filter for posts that don't match the current slug.

'filter' => 'postSlug',
'match' => 'neq',
'value' => perch_get('s'),

Amazing, thanks Drew!