Features
Since version 3.9
To learn more about extension features, you can read the Extension Features reference docs.
root-error-meta
Generates the title and description meta tags for a route error response.
config.messages
A function that returns an inner function with intl as a parameter that returns a PromiseLike of an object containing the messages for different route errors.
Example
./example-extension/index.ts
export default defineExtension({
// ...
unstable_lifecycleHooks: {
onFeaturesInit: (hooks) => {
hooks.registerFeature("root-error-meta", {
config: {
messages: () => {
return (intl: IntlShape) => {
"404": {
// with intl translations
title: intl.formatMessage({ id: "404.title" }),
description: intl.formatMessage({ id: "404.description" }),
},
"500": {
// without intl translations
title: "Some error occurred",
description: "Please try again later",
},
};
},
},
});
},
},
});