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 2feee8c commit 1c397ee
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": "favicon-downloader",
"version": "0.1.5.rc",
"version": "0.1.6.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 @@ -30,10 +30,7 @@ export async function generateMetadata({ params }:{ params: any }): Promise<Meta
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 @@ -22,7 +22,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 @@ -38,7 +38,7 @@ export const createAlternates = ({ headers, canonical }: { headers: Headers; can
})

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

0 comments on commit 1c397ee

Please sign in to comment.