From d2bffdf48a7c49119ede9d3b393dac775cd21bc2 Mon Sep 17 00:00:00 2001 From: Sean Wood Date: Tue, 20 May 2025 17:24:29 +0100 Subject: [PATCH 1/2] docs(start/framework/route-module): clarify the behaviour of multiple `meta` functions (#13642) --- contributors.yml | 1 + docs/start/framework/route-module.md | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contributors.yml b/contributors.yml index 95e6c4ee93..e53c35c427 100644 --- a/contributors.yml +++ b/contributors.yml @@ -382,6 +382,7 @@ - willsawyerrrr - willsmithte - wkovacs64 +- woodywoodsta - xavier-lc - xcsnowcity - xdaxer diff --git a/docs/start/framework/route-module.md b/docs/start/framework/route-module.md index 9f22d36b19..0d6e64ccbe 100644 --- a/docs/start/framework/route-module.md +++ b/docs/start/framework/route-module.md @@ -309,9 +309,9 @@ export default function Root() { ## `meta` -Route meta defines meta tags to be rendered in the `` of the document. +Route meta defines meta tags to be rendered in the `` component, usually placed in the ``. -```tsx +```tsx filename=app/product.tsx export function meta() { return [ { title: "Very cool app" }, @@ -326,10 +326,7 @@ export function meta() { ]; } ``` - -All routes' meta will be aggregated and rendered through the `` component, usually rendered in your app root: - -```tsx +```tsx filename=app/root.tsx import { Meta } from "react-router"; export default function Root() { @@ -345,6 +342,8 @@ export default function Root() { } ``` +The meta of the last matching route is used, allowing you to override parent routes' meta. It's important to note that the entire meta descriptor array is replaced, not merged. This gives you the flexibility to build your own meta composition logic across pages at different levels. + **See also** - [`meta` params][meta-params] From 8027529a008408508b699a8d3cd1d1801ae6fe4f Mon Sep 17 00:00:00 2001 From: Remix Run Bot Date: Tue, 20 May 2025 16:25:10 +0000 Subject: [PATCH 2/2] chore: format --- docs/start/framework/route-module.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/start/framework/route-module.md b/docs/start/framework/route-module.md index 0d6e64ccbe..f3ada299bb 100644 --- a/docs/start/framework/route-module.md +++ b/docs/start/framework/route-module.md @@ -326,6 +326,7 @@ export function meta() { ]; } ``` + ```tsx filename=app/root.tsx import { Meta } from "react-router";