Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seadfeng committed Aug 23, 2024
1 parent 4b484c5 commit 9f5b2b8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redirectcheck",
"version": "0.1.3.rc",
"version": "0.1.4.rc",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
7 changes: 2 additions & 5 deletions src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { appConfig, type LocaleType } from "@/config";
import getRequestConfig from "@/i18n";
import { cn, createAlternates, getCanonical } from "@/lib/utils";
import { cn, createAlternates } from "@/lib/utils";
import { GoogleAnalytics } from '@next/third-parties/google';
import type { Metadata } from "next";
import { NextIntlClientProvider } from "next-intl";
Expand Down Expand Up @@ -29,10 +29,7 @@ export async function generateMetadata(locale: LocaleType): Promise<Metadata> {
template: `%s - ${appConfig.appRootDomain}`,
},
description: t('frontend.meta.default.description'),
alternates: createAlternates({
canonical: getCanonical({headers: headersList}),
headers: headersList
})
alternates: createAlternates({ headers: headersList })
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getCanonical = ({ headers }: { headers: Headers }) => {
return `${origin}${url.pathname}`;
}

export const createAlternates = ({ headers, canonical }: { headers: Headers; canonical: string; }) => {
export const createAlternates = ({ headers }: { headers: Headers; }) => {
let languages = {} as Record<LocaleType, string>;
const linkStr = headers.get("Link")!;
const links = linkStr.split(',');
Expand All @@ -35,7 +35,7 @@ export const createAlternates = ({ headers, canonical }: { headers: Headers; can
})

return {
canonical,
canonical: getCanonical({ headers }),
languages
}
}

0 comments on commit 9f5b2b8

Please sign in to comment.