Replies: 1 comment 1 reply
-
Hi @thany !
You should be able to go through all the individual properties and adjust site behavior when needed. |
Beta Was this translation helpful? Give feedback.
-
Hi @thany !
You should be able to go through all the individual properties and adjust site behavior when needed. |
Beta Was this translation helpful? Give feedback.
-
Description
In a component-level getServerSideProps in a Next.js application, how do I make the page become a 404? What props can I set or return in order to cause a 404? The documentation is quite lacking in this regard. Regular Next.js says you just have to return
{ notFound: true }
, but in a JSS application this won't work - it only works like that at page-level.I think it's pretty commonplace that if a component cannot find its data, that the whole page is allowed to be a 404. But maybe's we're unique. I dunno, but it seems fairly basic to me. Yet, I cannot find for the life of me how to do this properly.
Only thing I found, is to set
layoutData.sitecore.route = null;
which does cause the whole page to be not found, but I don't think it's the right way, because in the SitecorePageProps,notFound
remains false.The only proper way I found to do this, is possible only at page-level getServerSideProps, but this is useless because of the way JSS is set up - every page is rendered through
[[...path]].tsx
so at that level I have no way of knowing what might or might not exist. That's for the components to know.Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions