Skip to content

Commit 20cc909

Browse files
authored
refactor: layout locations and code styling updates (nodejs#6098)
* docs: location of layout updated * refactor: types allias import * refactor: destructuring params * refactor: unnecessary map usage removed
1 parent 35a4589 commit 20cc909

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

COLLABORATOR_GUIDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- [Adding new pages](#adding-new-pages)
99
- [Create the page content](#create-the-page-content)
1010
- [Translating pages](#translating-pages)
11-
- [Creating Components](#creating-components)
11+
- [Creating Components](#creating-react-components)
1212
- [Styling a Component](#styling-a-component)
1313
- [Best practices when creating a Component](#best-practices-when-creating-a-component)
1414
- [How a new Component should look like when freshly created](#how-a-new-component-should-look-like-when-freshly-created)
@@ -141,7 +141,7 @@ layout: layout-name.hbs
141141
```
142142

143143
> \[!NOTE]\
144-
> A list of currently available Layouts is provided within `providers/layoutProvider` on the `getLegacyProviders` map.\
144+
> A list of currently available Layouts is provided within `components/withLayout` on the `layoutComponents` map.\
145145
> This is a temporary map and this map might change its location and be defined in a different way in the future.
146146
147147
### Translating Pages

app/[locale]/[[...path]]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export const viewport = DEFAULT_VIEWPORT;
1919

2020
// This generates each page's HTML Metadata
2121
// @see https://nextjs.org/docs/app/api-reference/functions/generate-metadata
22-
export const generateMetadata = async (c: DynamicParams) => {
23-
const { path = [], locale = defaultLocale.code } = c.params;
22+
export const generateMetadata = async ({ params }: DynamicParams) => {
23+
const { path = [], locale = defaultLocale.code } = params;
2424

2525
const pathname = dynamicRouter.getPathname(path);
2626

app/sitemap.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ const sitemap = async (): Promise<MetadataRoute.Sitemap> => {
1919

2020
for (const locale of availableLocaleCodes) {
2121
const routesForLanguage = await dynamicRouter.getRoutesByLanguage(locale);
22-
23-
paths.push(...routesForLanguage.map(route => `${locale}/${route}`));
22+
paths.push(
23+
...routesForLanguage.map(route => `${baseUrlAndPath}/${locale}/${route}`)
24+
);
2425
}
2526

2627
const currentDate = new Date().toISOString();
2728

28-
const appRoutes = paths.sort().map(route => `${baseUrlAndPath}/${route}`);
29-
30-
return [...appRoutes, ...EXTERNAL_LINKS_SITEMAP].map(route => ({
29+
return [...paths, ...EXTERNAL_LINKS_SITEMAP].map(route => ({
3130
url: route,
3231
lastModified: currentDate,
3332
changeFrequency: 'always',

client-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { cache } from 'react';
22

3-
import type { ClientSharedServerContext } from './types';
3+
import type { ClientSharedServerContext } from '@/types';
44

55
// This allows us to have Server-Side Context's of the shared "contextual" data
66
// which includes the frontmatter, the current pathname from the dynamic segments

0 commit comments

Comments
 (0)