Developer forum

Forum » CMS - Standard features » ItemPublisher - show everything but current item

ItemPublisher - show everything but current item

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

This is a regular challange, that we basically have ignored - but we have a situation where we need to do it "right"

We have a regular website, containing Item based News.

On a news page (based on a newsitem), we show a list of 5 other newsitems (a list of 5 of the newest items). This is being included on the newsitem template via RenderParagraphContent(), where we include a paragraph with an ItemPublisher.

But the problem is, that if we are on one of the top 5 newest newsitems, the newsitem reoccurs in the list showing the 5 newsitems.

In other words, we want to exclude the current item from the list of newest items.

Now I know that we can solve this using indexing and a query excluding the current item etc. but that seems really cumbersome to have to do, just in order to get a list of items not containing the current item.

 

Is there no other and simpler way of doing this?

 

/Hans


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Hans,

 

What about getting the Top 6, but only show/render the Top 5?

 

A simple if statement should be enough to exclude the current one. I know there's some wasted computing cycles about the extra news that will likely be thrown away, but that's a quick solution without having to refactor everything to the query publisher. (and yout Top 6 will be cached by Dynamicweb anyway, so it should not have a noticeable impact.

 

Best Regards,

Nuno Aguiar

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Thanks Nuno 👍🏻

that´s of course an option. I will look into it.

/Hans

 

You must be logged in to post in the forum