What navigation pattern for Lightning Community created be the new Community Builder could be recommended?

I’m not sure what navigation pattern is best for Lightning Communities. Use case is a quite simple: ListView => DetailView navigation hosted on a community page.

Reading through @DougChasmans example here, I found it somehow hard to read, understand and replicate. In the documentation I also did not find anything at the first glance.

Besides the basic navigation (the actual swapping of the views), I would like to support the following requirements:

  • needs to work inside a Community
  • navigation with links, not with buttons
  • working Browser forward/backward navigation
  • usable Browser history
  • ability to deep-link record-detail-views
  • ability to open links in new tabs (right-click > open in new tab OR middle-click), especially no javascript:void(0); on the href.

I’m not sure, if Dougs pattern would support these features or only swap the components while sticking on the singe base-URL? Would it work on a community page? Since I was not able to replicate it, I could not test it. So any feedback on this would be highly appreciated. If it matches the requirements, I will try harder to dive into it.

Is there any example coming close to this requirements published anywhere?

My first reflex was to keep it simple, break the SPA-patter (SPA is not required, Desktop-only-use-case) and go with URLs parameters. This would work fine in standalone Lightning Apps


Now on a Lightning Community page created with the new Community Builder, if you navigate to


it automatically reroutes to


truncating the provided parameter… 🙁

Not even hashes (to navigate to anchors) are possible. This also doesn’t work


but it reroutes to an error-page. So another good browser feature is broken and must be reworked via JS if needed… my idea was to abuse the hash for parameters – a bit in the manner like Angular does for routing – but no chance.

Do I miss here something? Is there a way to use URL parameters? Is there an other viable pattern with event-navigation and still keeps my browser-history, browser-navigation, deep-link functionality and middle-click-open-in-new-tab navi?

This question is particularly for communities, where potential workaround seems to be very hard or impossible at this time. Now I’ve asked a similar question in general hoping to find a workaround here: How to use a strong URL-aware navigation/routing pattern in Lightning?


Don’t have the reputation points for a comment but the only way I’ve figured out how to do this is by using HTML5 session storage. You can add the equivalent of the query string to the session storage, then fire the navToURL event and then on the navigation destination side read from the session storage, get the params, and clear them. It’s a hack but the only thing i’ve figured out so far.

Source : Link , Question Author : Uwe Heim , Answer Author : Chad Armstrong

Leave a Comment