Skip to content

Commit 8b5e526

Browse files
Add layout nesting tip to the SEO chapters (#93)
* Add layout nesting tip to the SEO chapters It can be confusing to people that once they set the `meta` override to the `app/routes/users+/$username.tsx` file, the pages in the child URL seem to ignore those overrides. This PR adds some notes on the solution page of the "Meta Overrides" activity to refresh that information, already shown in the "Routes" part. * Update exercises/06.seo/02.solution.nested/README.mdx --------- Co-authored-by: Kent C. Dodds <[email protected]>
1 parent 55cd8df commit 8b5e526

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

exercises/06.seo/02.solution.nested/README.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,24 @@
44

55
👨‍💼 Great! Now we can customize the meta tags on our routes! Let's do a bit more
66
for our profile pages.
7+
8+
<callout-info>
9+
🦉 You'll notice that if you navigate to the `/users/kody` route, you'll see
10+
the `Profile | Epic Notes` in the title. But you'll see only `Epic Notes`
11+
when you navigate to one of its child URLs, like `/users/kody/notes`. It
12+
behaves like that because, regardless the 2 URLs have a parent-child
13+
relationship, in terms of layout, `/users/kody/notes` is not a child of
14+
`/users/kody`. Remember that the latter folder path is defined like this:
15+
`routes/users+/$username.tsx` while the former's path is
16+
`routes/users+/$username_+/notes.tsx`. That little underscore in the name of
17+
the folder `$username_+` means that the pages inside will skip using the
18+
layout defined in the `routes/users+/$username.tsx` file. In other words,
19+
they won't be "layout-nested", even if they will be "url-nested". And, because
20+
they won't be layout-nested, they won't inherit the meta override defined
21+
in the `routes/users+/$username.tsx`, following, instead, the meta override
22+
defined in the `routes/root.tsx` which is its parent regarding layout. One way
23+
of seeing the layout parent-child relationships is by typing the
24+
`npx remix routes` in a terminal at the root of a remix project to see how
25+
the routes will be configured. It should give you a better view of the
26+
router layout-nesting structure.
27+
</callout-info>

0 commit comments

Comments
 (0)