Modifying the return status of a page
Modifying the return status allows you to correctly inform the browser of the return being sent on the page based on any desired criteria. This ensures better indexing by search engines since, for example, a page not found with the correct status will not be indexed by them.
To modify the return status of a page from a section, follow these simple steps:
loader
function, define the condition that determines whether
the status should be modified. If the condition is met, assign the desired
status to the response contained in the context.Let’s say you want your page to return 404 (Not Found)
if your search returns
no elements:
In this example, if the items
property does not exist or does not contain any
elements, the section will modify the return status of the entire page to 404
.
Modifying the return status of a page
Modifying the return status allows you to correctly inform the browser of the return being sent on the page based on any desired criteria. This ensures better indexing by search engines since, for example, a page not found with the correct status will not be indexed by them.
To modify the return status of a page from a section, follow these simple steps:
loader
function, define the condition that determines whether
the status should be modified. If the condition is met, assign the desired
status to the response contained in the context.Let’s say you want your page to return 404 (Not Found)
if your search returns
no elements:
In this example, if the items
property does not exist or does not contain any
elements, the section will modify the return status of the entire page to 404
.