MCPcopy
hub / github.com/nuxt/nuxt / definePageMeta

Function definePageMeta

packages/nuxt/src/pages/runtime/composables.ts:77–92  ·  view source on GitHub ↗
(meta: PageMeta)

Source from the content-addressed store, hash-verified

75
76// eslint-disable-next-line @typescript-eslint/no-unused-vars
77export const definePageMeta = (meta: PageMeta): void => {
78 if (import.meta.dev) {
79 const component = getCurrentInstance()?.type
80 try {
81 const isRouteComponent = component && useRoute().matched.some(p => Object.values(p.components || {}).includes(component))
82 const isRenderingServerPage = import.meta.server && useNuxtApp().ssrContext?.islandContext
83 if (isRouteComponent || isRenderingServerPage || ((component as any)?.__clientOnlyPage)) {
84 // don't warn if it's being used in a route component (or server page)
85 return
86 }
87 } catch {
88 // ignore any errors with accessing current instance or route
89 }
90 warnRuntimeUsage('definePageMeta')
91 }
92}
93
94/**
95 * You can define route rules for the current page. Matching route rules will be created, based on the page's _path_.

Callers 1

app-types.tsFile · 0.85

Calls 3

useNuxtAppFunction · 0.90
useRouteFunction · 0.85
warnRuntimeUsageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…