diff --git a/next-sitemap.config.js b/next-sitemap.config.js
index aa9e9d4c..3951e697 100644
--- a/next-sitemap.config.js
+++ b/next-sitemap.config.js
@@ -2,5 +2,5 @@
module.exports = {
siteUrl: process.env.SITE_URL || 'https://www.abyss-lab.app',
generateRobotsTxt: true,
- exclude: ['*/prints/*'],
+ exclude: ['*/temp/*'],
}
diff --git a/src/components/atoms/Head.tsx b/src/components/atoms/Head.tsx
index 7be5b718..b1e5c486 100644
--- a/src/components/atoms/Head.tsx
+++ b/src/components/atoms/Head.tsx
@@ -1,11 +1,15 @@
import NextHead from 'next/head'
+import { useRouter } from 'next/router'
+import { baseUrl } from '../../lib/consts'
interface HeadProps {
title: string
description?: string
+ canonicalHref?: string
}
-const Head = ({ title, description }: HeadProps) => {
+const Head = ({ title, description, canonicalHref }: HeadProps) => {
+ const { locale } = useRouter()
return (
{title}
@@ -19,6 +23,14 @@ const Head = ({ title, description }: HeadProps) => {
/>
+ {canonicalHref && (
+
+ )}
)
}
diff --git a/src/components/pages/SingleStigmataPage.tsx b/src/components/pages/SingleStigmataPage.tsx
index 24e0c16e..065c2bb6 100644
--- a/src/components/pages/SingleStigmataPage.tsx
+++ b/src/components/pages/SingleStigmataPage.tsx
@@ -43,6 +43,7 @@ const SingleStigmataPage = ({
)} / HP : ${stigmataData.hp} / ATK : ${stigmataData.atk} / DEF : ${
stigmataData.def
} / CRT : ${stigmataData.crt}`}
+ canonicalHref={`/honkai3rd/stigmata/${stigmataData.id}`}
/>
diff --git a/src/lib/consts.ts b/src/lib/consts.ts
index e7fa0629..a6dc192b 100644
--- a/src/lib/consts.ts
+++ b/src/lib/consts.ts
@@ -1,2 +1,3 @@
export const assetsBucketBaseUrl =
process.env.NEXT_PUBLIC_ASSETS_BUCKET_BASE_URL
+export const baseUrl = process.env.NEXT_PUBLIC_BASE_URL
diff --git a/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx b/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx
index a1e1a7be..2bb90924 100644
--- a/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx
+++ b/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx
@@ -98,6 +98,7 @@ const BattlesuitShowPage = ({
return translate(locale, { 'ko-KR': krLabel }, label)
})
.join(', ')}`}
+ canonicalHref={`/honkai3rd/battlesuits/${battlesuit.id}`}
/>
diff --git a/src/pages/honkai3rd/battlesuits/index.tsx b/src/pages/honkai3rd/battlesuits/index.tsx
index da57e761..e8aef62a 100644
--- a/src/pages/honkai3rd/battlesuits/index.tsx
+++ b/src/pages/honkai3rd/battlesuits/index.tsx
@@ -99,6 +99,7 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
'common.abyss-lab'
)}`}
description={t('battlesuits-list.description')}
+ canonicalHref={`/honkai3rd/battlesuits`}
/>
diff --git a/src/pages/honkai3rd/elfs/[elfId].tsx b/src/pages/honkai3rd/elfs/[elfId].tsx
index 175b1f88..901ab90b 100644
--- a/src/pages/honkai3rd/elfs/[elfId].tsx
+++ b/src/pages/honkai3rd/elfs/[elfId].tsx
@@ -52,6 +52,7 @@ const ElfShowPage = ({ elf }: ElfShowPageProps) => {
return translate(locale, { 'ko-KR': krLabel }, label)
})
.join(', ')}`}
+ canonicalHref={`/honkai3rd/elfs/${elf.id}`}
/>
diff --git a/src/pages/honkai3rd/elfs/index.tsx b/src/pages/honkai3rd/elfs/index.tsx
index 27aee0b6..74d95ad6 100644
--- a/src/pages/honkai3rd/elfs/index.tsx
+++ b/src/pages/honkai3rd/elfs/index.tsx
@@ -25,6 +25,7 @@ const ElfListPage = ({ elfs }: ElfListPageProps) => {
'common.abyss-lab'
)}`}
description={t('elfs-list.description')}
+ canonicalHref={`/honkai3rd/elfs`}
/>
diff --git a/src/pages/honkai3rd/elysian-realm/index.tsx b/src/pages/honkai3rd/elysian-realm/index.tsx
index 424dad15..b1718779 100644
--- a/src/pages/honkai3rd/elysian-realm/index.tsx
+++ b/src/pages/honkai3rd/elysian-realm/index.tsx
@@ -45,6 +45,7 @@ const ElysianRealmIndexPage = ({
'common.abyss-lab'
)}`}
description={t('common.elysian-realm')}
+ canonicalHref={`/honkai3rd/elysian-realm`}
/>
diff --git a/src/pages/honkai3rd/elysian-realm/remembrance-sigils.tsx b/src/pages/honkai3rd/elysian-realm/remembrance-sigils.tsx
index 284ca43a..801d1312 100644
--- a/src/pages/honkai3rd/elysian-realm/remembrance-sigils.tsx
+++ b/src/pages/honkai3rd/elysian-realm/remembrance-sigils.tsx
@@ -30,6 +30,7 @@ const ElysianRealmIndexPage = ({
description={`${t('common.elysian-realm')} ${t(
'elysian-realm.supports'
)}`}
+ canonicalHref={`/honkai3rd/elysian-realm/remembrance-sigils`}
/>
diff --git a/src/pages/honkai3rd/elysian-realm/signets/[signetId].tsx b/src/pages/honkai3rd/elysian-realm/signets/[signetId].tsx
index 7b8a0b20..c2ee079d 100644
--- a/src/pages/honkai3rd/elysian-realm/signets/[signetId].tsx
+++ b/src/pages/honkai3rd/elysian-realm/signets/[signetId].tsx
@@ -35,6 +35,7 @@ const SignetShowPage = ({ signetId, signetGroup }: SignetShowPageProps) => {
description={`${t('common.honkai-3rd')} ${signetGroup.name} ${t(
'elysian-realm.signets'
)}`}
+ canonicalHref={`/honkai3rd/elysian-realm/signets/${signetId}`}
/>
diff --git a/src/pages/honkai3rd/elysian-realm/support-battlesuits.tsx b/src/pages/honkai3rd/elysian-realm/support-battlesuits.tsx
index c04fc515..3f29463e 100644
--- a/src/pages/honkai3rd/elysian-realm/support-battlesuits.tsx
+++ b/src/pages/honkai3rd/elysian-realm/support-battlesuits.tsx
@@ -37,6 +37,7 @@ const ElysianRealmIndexPage = ({
description={`${t('common.elysian-realm')} ${t(
'elysian-realm.supports'
)}`}
+ canonicalHref={`/honkai3rd/elysian-realm/support-battlesuits`}
/>
diff --git a/src/pages/honkai3rd/elysian-realm/utils/gen-guide.tsx b/src/pages/honkai3rd/elysian-realm/utils/gen-guide.tsx
index f876ccfb..e9b173cd 100644
--- a/src/pages/honkai3rd/elysian-realm/utils/gen-guide.tsx
+++ b/src/pages/honkai3rd/elysian-realm/utils/gen-guide.tsx
@@ -19,6 +19,8 @@ import {
import { listStigmata } from '../../../../server/data/honkai3rd/stigmata'
import { listWeapons } from '../../../../server/data/honkai3rd/weapons'
import { getI18NProps } from '../../../../server/i18n'
+import Head from '../../../../components/atoms/Head'
+import { useTranslation } from 'next-i18next'
interface GenerateGuidePageProps {
weapons: WeaponData[]
@@ -36,9 +38,16 @@ const GenerateGuidePage = ({
sigils,
}: GenerateGuidePageProps) => {
const router = useRouter()
+ const { t } = useTranslation()
return (
+
diff --git a/src/pages/honkai3rd/enemies.tsx b/src/pages/honkai3rd/temp/enemies.tsx
similarity index 100%
rename from src/pages/honkai3rd/enemies.tsx
rename to src/pages/honkai3rd/temp/enemies.tsx
diff --git a/src/pages/honkai3rd/prints/battlesuits/[battlesuitId].tsx b/src/pages/honkai3rd/temp/prints/battlesuits/[battlesuitId].tsx
similarity index 87%
rename from src/pages/honkai3rd/prints/battlesuits/[battlesuitId].tsx
rename to src/pages/honkai3rd/temp/prints/battlesuits/[battlesuitId].tsx
index 0920bf6d..448ae3bb 100644
--- a/src/pages/honkai3rd/prints/battlesuits/[battlesuitId].tsx
+++ b/src/pages/honkai3rd/temp/prints/battlesuits/[battlesuitId].tsx
@@ -10,29 +10,29 @@ import {
} from '@theme-ui/components'
import { NextPageContext } from 'next'
import React from 'react'
-import BattlesuitFeatureLabel from '../../../../components/atoms/BattlesuitFeatureLabel'
-import BattlesuitRankIcon from '../../../../components/atoms/BattlesuitRankIcon'
-import PageLink from '../../../../components/atoms/PageLink'
-import SecondaryLabel from '../../../../components/atoms/SecondaryLabel'
-import TypeLabel from '../../../../components/atoms/TypeLabel'
-import ValkyrieLabel from '../../../../components/atoms/ValkyrieLabel'
+import BattlesuitFeatureLabel from '../../../../../components/atoms/BattlesuitFeatureLabel'
+import BattlesuitRankIcon from '../../../../../components/atoms/BattlesuitRankIcon'
+import PageLink from '../../../../../components/atoms/PageLink'
+import SecondaryLabel from '../../../../../components/atoms/SecondaryLabel'
+import TypeLabel from '../../../../../components/atoms/TypeLabel'
+import ValkyrieLabel from '../../../../../components/atoms/ValkyrieLabel'
import {
BattlesuitData,
BattlesuitSkillGroup,
-} from '../../../../lib/honkai3rd/battlesuits'
-import { generateI18NPaths, getI18NProps } from '../../../../server/i18n'
+} from '../../../../../lib/honkai3rd/battlesuits'
+import { generateI18NPaths, getI18NProps } from '../../../../../server/i18n'
import {
getBattlesuitById,
listBattlesuits,
-} from '../../../../server/data/honkai3rd/battlesuits'
-import { useTranslation } from '../../../../lib/i18n'
-import { assetsBucketBaseUrl } from '../../../../lib/consts'
-import { WeaponData } from '../../../../lib/honkai3rd/weapons'
-import { getWeaponMapByIds } from '../../../../server/data/honkai3rd/weapons'
-import { StigmataData } from '../../../../lib/honkai3rd/stigmata'
-import WeaponCard from '../../../../components/molecules/WeaponCard'
-import StigmataCard from '../../../../components/molecules/StigmataCard'
-import { getStigmataMapByIds } from '../../../../server/data/honkai3rd/stigmata'
+} from '../../../../../server/data/honkai3rd/battlesuits'
+import { useTranslation } from '../../../../../lib/i18n'
+import { assetsBucketBaseUrl } from '../../../../../lib/consts'
+import { WeaponData } from '../../../../../lib/honkai3rd/weapons'
+import { getWeaponMapByIds } from '../../../../../server/data/honkai3rd/weapons'
+import { StigmataData } from '../../../../../lib/honkai3rd/stigmata'
+import WeaponCard from '../../../../../components/molecules/WeaponCard'
+import StigmataCard from '../../../../../components/molecules/StigmataCard'
+import { getStigmataMapByIds } from '../../../../../server/data/honkai3rd/stigmata'
type WeaponObjectMap = { [key: string]: WeaponData }
type StigmataObjectMap = { [key: string]: StigmataData }
diff --git a/src/pages/honkai3rd/prints/stigmata/[stigmataId].tsx b/src/pages/honkai3rd/temp/prints/stigmata/[stigmataId].tsx
similarity index 88%
rename from src/pages/honkai3rd/prints/stigmata/[stigmataId].tsx
rename to src/pages/honkai3rd/temp/prints/stigmata/[stigmataId].tsx
index 3afece0a..660fb93f 100644
--- a/src/pages/honkai3rd/prints/stigmata/[stigmataId].tsx
+++ b/src/pages/honkai3rd/temp/prints/stigmata/[stigmataId].tsx
@@ -1,21 +1,21 @@
/** @jsxImportSource theme-ui */
import { NextPageContext } from 'next'
import React from 'react'
-import PageLink from '../../../../components/atoms/PageLink'
-import { StigmataSetProps } from '../../../../components/pages/StigmataSetPage'
-import { generateI18NPaths, getI18NProps } from '../../../../server/i18n'
+import PageLink from '../../../../../components/atoms/PageLink'
+import { StigmataSetProps } from '../../../../../components/pages/StigmataSetPage'
+import { generateI18NPaths, getI18NProps } from '../../../../../server/i18n'
import {
listStigmata,
getStigmataListBySetId,
getStigmataSetBySetId,
listStigmataSet,
getStigmaById,
-} from '../../../../server/data/honkai3rd/stigmata'
+} from '../../../../../server/data/honkai3rd/stigmata'
import { Box, Card, Flex, Heading, Paragraph } from 'theme-ui'
-import SecondaryLabel from '../../../../components/atoms/SecondaryLabel'
-import StigmataCard from '../../../../components/molecules/StigmataCard'
-import { useTranslation } from '../../../../lib/i18n'
-import { SingleStigmataPageProps } from '../../../../components/pages/SingleStigmataPage'
+import SecondaryLabel from '../../../../../components/atoms/SecondaryLabel'
+import StigmataCard from '../../../../../components/molecules/StigmataCard'
+import { useTranslation } from '../../../../../lib/i18n'
+import { SingleStigmataPageProps } from '../../../../../components/pages/SingleStigmataPage'
type StigmataShowPageProps = StigmataSetProps | SingleStigmataPageProps
diff --git a/src/pages/honkai3rd/prints/weapons/[weaponId].tsx b/src/pages/honkai3rd/temp/prints/weapons/[weaponId].tsx
similarity index 86%
rename from src/pages/honkai3rd/prints/weapons/[weaponId].tsx
rename to src/pages/honkai3rd/temp/prints/weapons/[weaponId].tsx
index a0d90893..588cdf86 100644
--- a/src/pages/honkai3rd/prints/weapons/[weaponId].tsx
+++ b/src/pages/honkai3rd/temp/prints/weapons/[weaponId].tsx
@@ -1,21 +1,24 @@
/** @jsxImportSource theme-ui */
import { Flex, Box, Card, Heading, Paragraph } from '@theme-ui/components'
import { NextPageContext } from 'next'
-import SquareImageBox from '../../../../components/atoms/SquareImageBox'
-import { weaponCategories, WeaponData } from '../../../../lib/honkai3rd/weapons'
-import { generateI18NPaths, getI18NProps } from '../../../../server/i18n'
+import SquareImageBox from '../../../../../components/atoms/SquareImageBox'
+import {
+ weaponCategories,
+ WeaponData,
+} from '../../../../../lib/honkai3rd/weapons'
+import { generateI18NPaths, getI18NProps } from '../../../../../server/i18n'
import {
getWeaponById,
getWeaponMapByIds,
listWeapons,
-} from '../../../../server/data/honkai3rd/weapons'
-import { useTranslation } from '../../../../lib/i18n'
-import PageLink from '../../../../components/atoms/PageLink'
-import { assetsBucketBaseUrl } from '../../../../lib/consts'
-import { getBattlesuitMapByIds } from '../../../../server/data/honkai3rd/battlesuits'
-import { BattlesuitData } from '../../../../lib/honkai3rd/battlesuits'
-import BattlesuitCard from '../../../../components/molecules/BattlesuitCard'
-import WeaponCard from '../../../../components/molecules/WeaponCard'
+} from '../../../../../server/data/honkai3rd/weapons'
+import { useTranslation } from '../../../../../lib/i18n'
+import PageLink from '../../../../../components/atoms/PageLink'
+import { assetsBucketBaseUrl } from '../../../../../lib/consts'
+import { getBattlesuitMapByIds } from '../../../../../server/data/honkai3rd/battlesuits'
+import { BattlesuitData } from '../../../../../lib/honkai3rd/battlesuits'
+import BattlesuitCard from '../../../../../components/molecules/BattlesuitCard'
+import WeaponCard from '../../../../../components/molecules/WeaponCard'
interface WeaponShowPageProps {
weapon: WeaponData
diff --git a/src/pages/honkai3rd/versions/[versionId].tsx b/src/pages/honkai3rd/versions/[versionId].tsx
index 3365996c..2c02ae17 100644
--- a/src/pages/honkai3rd/versions/[versionId].tsx
+++ b/src/pages/honkai3rd/versions/[versionId].tsx
@@ -65,6 +65,7 @@ const VersionShowPage = ({
return weapon.name
})
.join(',')}`}
+ canonicalHref={`/honkai3rd/versions/${versionData.version}`}
/>
diff --git a/src/pages/honkai3rd/versions/index.tsx b/src/pages/honkai3rd/versions/index.tsx
index 1f5ddb70..53a2795e 100644
--- a/src/pages/honkai3rd/versions/index.tsx
+++ b/src/pages/honkai3rd/versions/index.tsx
@@ -32,6 +32,7 @@ const VersionIndexPage = ({ versionDataList }: VersionIndexPageProps) => {
'common.abyss-lab'
)}`}
description={t('versions.list-page-description')}
+ canonicalHref={`/honkai3rd/versions`}
/>
diff --git a/src/pages/honkai3rd/weapons/[weaponId].tsx b/src/pages/honkai3rd/weapons/[weaponId].tsx
index a4be9373..28a4b8ed 100644
--- a/src/pages/honkai3rd/weapons/[weaponId].tsx
+++ b/src/pages/honkai3rd/weapons/[weaponId].tsx
@@ -49,6 +49,7 @@ const WeaponShowPage = ({
)} / ${'⭐'.repeat(weapon.rarity)} / ${weaponCategoryName} / ATK : ${
weapon.atk
} / CRT : ${weapon.crt}`}
+ canonicalHref={`/honkai3rd/weapons/${weapon.id}`}
/>
diff --git a/src/pages/honkai3rd/weapons/index.tsx b/src/pages/honkai3rd/weapons/index.tsx
index 4c930d94..38423836 100644
--- a/src/pages/honkai3rd/weapons/index.tsx
+++ b/src/pages/honkai3rd/weapons/index.tsx
@@ -57,6 +57,7 @@ const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => {
'common.abyss-lab'
)}`}
description={t('weapons-list.description')}
+ canonicalHref={`/honkai3rd/weapons`}
/>