Hide NEXT button for the last item in a dataset

Hi!

I created a dataset and data item template which has buttons “Previous post” and “Next post”. Data item pages are sorted by time created, so for the latest post, there shouldn’t be any “Next Post” button as it is the latest one. At the moment this button is shown, but it has no hand cursor as it is disabled with no link.

Maybe somebody could tell me, how can I hide the NEXT button for the latest item in the dataset and how can I hide the PREVIOUS button for the oldest one?

I guess it will have to be a code, but I have very little clue on how to write it.

Hope to hear from you guys!

Are you talking about a repeater?

No, I have a page with a repeater and all the existing posts (e.g. News (All)) , but I am talking about a page of a specific post (e.g. News (Title)) with simple buttons NEXT/PREVIOUS to go to other specific post pages of the same dataset. I hope I explained well…