Add custom content that only appears on your homepage

discovery.${defaultHomepage()} will match the route that is set as the landing route by the top-menu setting. It will match both the root URL / AND the specific route, like /categories.

In my experience there’s two complications when building a custom homepage based on defaultHomepage():

  • the route that it is build on is not available as a plain list view any longer
  • members can set their own default homepage in their interface settings. So one either needs to disable that feature or actually have a homepage concept that works on any of the top-menu routes

To only build a custom homepage on the root URL one can check for router.currentURL === '/'. By default, this only matches the root URL / and not the landing route set by the top-menu setting. However, there is logic now on the sidebar links that additionally aims to match a given URL to a route. So it won’t work on sidebar links by default. I just posted a topic on this: Can I have sidebar links that don’t resolve an url to a route?

In my understanding there’s currently no default way to build a custom homepage on the root URL without either targeting a route from the top-menu as well or running into issues with the sidebar. It would be great to have that option.

4 Likes