0

I have created a news list page in Hippo CMS. The news documents are listed properly, paginated (10 articles per page), with a detail page where the full news document is displayed.

I'd like to put a "back" link to the bottom of the detail page which can lead the user back to the list, to the exact page where the user clicked on the currently displayed article.

I thought this was a very common thing but had to realize the Essentials News component doesn't support this, and I wasn't able to find anything related in the documentation either.

What is the best approach to implement this feature?

fono
  • 135
  • 1
  • 8

2 Answers2

0

Easiest way is to create a sitmap item which points to desired location and give it an id. Than use:

<a href="<@hst.link siteMapItemRefId="news" />"  Back to news</a>

Or if you know path:

<a href="<@hst.link path="/news" />"  Back to news</a>
grunfy
  • 161
  • 1
  • 2
  • Thank you Marijan, this is easy indeed. However, it will not lead back to the page where the user found the document, it'll always navigate to the first page. I understand it might be hard to find out on which page the article is _at the moment_ (because in the mean time the article may "move" to another page because of insertion or deletion), so I'd be happy with a solution which leads the user back to the exact page where they left the list. – fono Sep 18 '15 at 12:21
0

I see. So you basically want browser back button functionality....like:

<a href="javascript:history.back()">back</a>

In ftl you could ask for referer option:

<@hst.defineObjects />${hstRequest.getHeader('referer')}

In jsp you would need JSP scriptlet, e.g:

<%=request.getHeader("referer")%>
grunfy
  • 161
  • 1
  • 2
  • Thanks Marijan. This is not exactly what I wanted though, but I'm afraid I won't get any closer to that (problem: this will only work if there is a referrer which is not always available, and it wouldn't work either when the details page has any funcionality which for example makes the page reload). – fono Sep 29 '15 at 12:19