Skip to content

Commit

Permalink
refactor: layout locations and code styling updates (#6098)
Browse files Browse the repository at this point in the history
* docs: location of layout updated

* refactor: types allias import

* refactor: destructuring params

* refactor: unnecessary map usage removed
  • Loading branch information
canerakdas authored Nov 9, 2023
1 parent 35a4589 commit 20cc909
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [Adding new pages](#adding-new-pages)
- [Create the page content](#create-the-page-content)
- [Translating pages](#translating-pages)
- [Creating Components](#creating-components)
- [Creating Components](#creating-react-components)
- [Styling a Component](#styling-a-component)
- [Best practices when creating a Component](#best-practices-when-creating-a-component)
- [How a new Component should look like when freshly created](#how-a-new-component-should-look-like-when-freshly-created)
Expand Down Expand Up @@ -141,7 +141,7 @@ layout: layout-name.hbs
```

> \[!NOTE]\
> A list of currently available Layouts is provided within `providers/layoutProvider` on the `getLegacyProviders` map.\
> A list of currently available Layouts is provided within `components/withLayout` on the `layoutComponents` map.\
> This is a temporary map and this map might change its location and be defined in a different way in the future.
### Translating Pages
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/[[...path]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const viewport = DEFAULT_VIEWPORT;

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

const pathname = dynamicRouter.getPathname(path);

Expand Down
9 changes: 4 additions & 5 deletions app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ const sitemap = async (): Promise<MetadataRoute.Sitemap> => {

for (const locale of availableLocaleCodes) {
const routesForLanguage = await dynamicRouter.getRoutesByLanguage(locale);

paths.push(...routesForLanguage.map(route => `${locale}/${route}`));
paths.push(
...routesForLanguage.map(route => `${baseUrlAndPath}/${locale}/${route}`)
);
}

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

const appRoutes = paths.sort().map(route => `${baseUrlAndPath}/${route}`);

return [...appRoutes, ...EXTERNAL_LINKS_SITEMAP].map(route => ({
return [...paths, ...EXTERNAL_LINKS_SITEMAP].map(route => ({
url: route,
lastModified: currentDate,
changeFrequency: 'always',
Expand Down
2 changes: 1 addition & 1 deletion client-context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cache } from 'react';

import type { ClientSharedServerContext } from './types';
import type { ClientSharedServerContext } from '@/types';

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

0 comments on commit 20cc909

Please sign in to comment.