It doesn’t seem to work for experience pages though, a 404 error is still shown and a standard 404 page is returned from the server. It can be ‘fixed’ by setting a componentconfigurationid to a standard content page on the sitemap items for the experience pages, but this is not supposed to be set according to the documentation: https://xmdocumentation.bloomreach.com/library/concepts/experience-pages/tutorial.html and it also says so in the ResolvedSitemapItemImpl:
// check whether there is a more specific mapping (note that for experience pages this is never needed)
String componentConfigurationId = resolveMappedConponentConfigurationId();
if you want your catch-all sitemap item to resolve to your 404 experience page document you will have to configure the property hst:relativecontentpath with value the path to your 404 document on your sitemap item.
However, in our sample spa project, there is a better example of how to handle error cases here.
In this case, your 404, 500 and error are separate experience documents created directly in your xpage folder.
Yes I understood that, but the experiences pages aren’t resolving to the catch-all sitemap item if the document belonging to the page cannot be found, the delivery api just returns a 404 status code.
We are not using Next.js, so I’m not sure how this routing works. How does it know that it has to go to the error experience page? Is it configured through the sitemap or in the web.xml? Is there also a repo for the backend?
I’m sorry I guess I didn’t explain it correctly, it’s not that I want the 404 page to be an experience page. I mean that we have a path for experience pages, like oursite.nl/content/existing-page but when somebody looks up a page that doesn’t exist (ousite.nl/content/non-existent-page), they only get a 404 error and a default error page from the server, they don’t get the contents from the 404 page returned from the delivery api.
Apologies, I misunderstood your initial question. In this case, you indeed have to configure the hst:componentconfigurationid and point to the default pagenotfound. The componentconfigurationid is actually used as a fallback exactly in cases when there are no xpage documents found.
There is a note about this in the sitemap item configuration section here
Ahh yeah I thought it wasn’t allowed, but since it’s in the docs that it’s allowed as a fallback, I guess I can use this solution after all then Thanks!!
We are happy you are part of Bloomreach Developer’s Community.
Thank you for reaching out to us.
We hope we have answered your queries and therefore marking this thread for Closure.
Looking forward to your continuous contribution towards our vibrant Bloomreach Community.