useFallbackTitle()
Usage
Use the auto-imported useFallbackTitle composable to access the fallback title that the module generates for the current page.
The title is resolved in this order:
- Error page title (e.g.,
404 - Page not found) when a 404 or 500 error is active route.meta.titleif set viadefinePageMeta()pages.{routeName}.titlei18n translation key (when@nuxtjs/i18nis installed)- Title-cased last URL path segment (e.g.,
/about-usbecomesAbout Us)
const title = useFallbackTitle()
// Ref<string | null>This is useful when building custom modules or components that need access to the same fallback title logic used internally by the module.
Return Value
- Type:
ComputedRef<string | null>
Returns null for the root path (/) when no route.meta.title is set.
Was this page helpful?