Search code examples
hippocms

How to generate back link for document lists in Hippo CMS?


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?


Solution

  • 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")%>