From 6924c88bf2cff34e5b7060a6dcaec5eaf3c7bf1b Mon Sep 17 00:00:00 2001 From: Sakura Knoll Date: Mon, 10 Jan 2022 18:51:34 +0900 Subject: [PATCH] Improve SEO --- public/locales/en-US/common.json | 14 ++++++- public/locales/ko-KR/common.json | 20 +++++++-- src/components/atoms/Head.tsx | 26 ++++++++++++ src/components/pages/SingleStigmataPage.tsx | 12 ++++++ src/components/pages/StigmataSetPage.tsx | 9 ++++ .../honkai3rd/battlesuits/[battlesuitId].tsx | 41 +++++++++++++++++++ src/pages/honkai3rd/battlesuits/index.tsx | 7 ++++ src/pages/honkai3rd/elfs/[elfId].tsx | 21 ++++++++++ src/pages/honkai3rd/elfs/index.tsx | 8 ++++ src/pages/honkai3rd/index.tsx | 5 +++ src/pages/honkai3rd/stigmata/index.tsx | 7 ++++ src/pages/honkai3rd/versions/[versionId].tsx | 21 ++++++++++ src/pages/honkai3rd/versions/index.tsx | 8 ++++ src/pages/honkai3rd/weapons/[weaponId].tsx | 12 +++++- src/pages/honkai3rd/weapons/index.tsx | 7 ++++ src/pages/index.tsx | 2 + 16 files changed, 214 insertions(+), 6 deletions(-) create mode 100644 src/components/atoms/Head.tsx diff --git a/public/locales/en-US/common.json b/public/locales/en-US/common.json index 2fa82084..c33942d5 100644 --- a/public/locales/en-US/common.json +++ b/public/locales/en-US/common.json @@ -21,15 +21,18 @@ "stigmata": "Stigmata", "weapons": "Weapons", "elfs": "ELFs", - "versions": "Versions" + "versions": "Versions", + "description": "Unofficial Honkai 3rd Wiki" }, "battlesuits-list": { "heading": "Battlesuits", + "description": "Battlesuit list of Honkai 3rd", "filters": "Filters", "filter-by-features": "Filter by Features", "filter-by-valkyries": "Filter by Valkyries" }, "battlesuit-show": { + "battlesuit": "battlesuit", "leader": "Leader", "passive": "Passive", "evasion": "Evasion", @@ -39,19 +42,24 @@ "sp-skill": "SP Skill" }, "stigmata-list": { + "description": "Stigmata list of Honkai 3rd", "stigmata": "Stigmata", "set-list": "Set List" }, "stigmata-show": { + "stigmata": "Stigmata", + "stigmata-set": "Stigmata Set", "top": "Top", "mid": "Mid", "bot": "Bot" }, "weapons-list": { + "description": "Weapon list of Honkai 3rd", "weapons": "Weapons", "filter-by-category": "Filter by Category" }, "weapons-show": { + "weapon": "Weapon", "pistol": "Pistol", "cannon": "Cannon", "katana": "Katana", @@ -63,15 +71,19 @@ "bow": "Bow" }, "elfs-list": { + "description": "ELF list of Honkai 3rd", "elfs": "ELFs" }, "elfs-show": { + "elf": "ELF", "passive": "Passive", "basic": "Basic", "ultimate": "Ultimate", "team": "Team" }, "versions": { + "version": "Version", + "list-page-description": "Version info list of Honkai 3rd", "all-versions": "All Versions", "previous": "Previous Version", "next": "Next Version", diff --git a/public/locales/ko-KR/common.json b/public/locales/ko-KR/common.json index 3b8749f5..c19b50b5 100644 --- a/public/locales/ko-KR/common.json +++ b/public/locales/ko-KR/common.json @@ -5,7 +5,7 @@ "battlesuits": "발키리", "weapons": "무기", "stigmata": "성흔", - "elfs": "무장인형" + "elfs": "인형" }, "breadcrumb": { "honkai-3rd": "붕괴 3rd", @@ -15,16 +15,19 @@ "mid": "(중)", "bot": "(하)", "weapons": "무기", - "elfs": "무장인형", - "versions": "업데이트" + "elfs": "인형", + "versions": "업데이트", + "description": "비공식 붕괴 3rd 위키" }, "battlesuits-list": { "heading": "발키리", + "description": "붕괴 3rd 발키리 목록", "filters": "필터", "filter-by-features": "특성 필터", "filter-by-valkyries": "발키리 필터" }, "battlesuit-show": { + "battlesuit": "발키리", "leader": "리더 스킬", "passive": "패시브 스킬", "evasion": "회피", @@ -34,19 +37,24 @@ "sp-skill": "SP 스킬" }, "stigmata-list": { + "description": "붕괴 3rd 성흔 목록", "stigmata": "성흔", "set-list": "세트 일람" }, "stigmata-show": { + "stigmata": "성흔", + "stigmata-set": "성흔 세트", "top": "(상)", "mid": "(중)", "bot": "(하)" }, "weapons-list": { + "description": "붕괴 3rd 무기 목록", "weapons": "무기", "filter-by-category": "카테고리 필터" }, "weapons-show": { + "weapon": "무기", "pistol": "쌍권총", "cannon": "대포", "katana": "태도", @@ -58,15 +66,19 @@ "bow": "활" }, "elfs-list": { - "elfs": "무장인형" + "description": "붕괴 3rd 인형 목록", + "elfs": "인형" }, "elfs-show": { + "elf": "인형", "passive": "패시브", "basic": "기본 공격", "ultimate": "필살기", "team": "팀" }, "versions": { + "version": "업데이트", + "list-page-description": "붕괴 3rd 업데이트 정보 목록", "all-versions": "모든 업데이트", "previous": "이전 버전", "next": "다음 버전", diff --git a/src/components/atoms/Head.tsx b/src/components/atoms/Head.tsx new file mode 100644 index 00000000..7be5b718 --- /dev/null +++ b/src/components/atoms/Head.tsx @@ -0,0 +1,26 @@ +import NextHead from 'next/head' + +interface HeadProps { + title: string + description?: string +} + +const Head = ({ title, description }: HeadProps) => { + return ( + + {title} + + + + + ) +} + +export default Head diff --git a/src/components/pages/SingleStigmataPage.tsx b/src/components/pages/SingleStigmataPage.tsx index 9f98e655..6c5674e0 100644 --- a/src/components/pages/SingleStigmataPage.tsx +++ b/src/components/pages/SingleStigmataPage.tsx @@ -9,6 +9,7 @@ import Honkai3rdNavigator from '../../components/organisms/Honkai3rdNavigator' import SecondaryLabel from '../atoms/SecondaryLabel' import { useRouter } from 'next/router' import { translate, useTranslation } from '../../lib/i18n' +import Head from '../atoms/Head' export interface SingleStigmataPageProps { type: 'single' @@ -41,6 +42,17 @@ const SingleStigmataPage = ({ return ( + + diff --git a/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx b/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx index 0ef820a0..cf36121c 100644 --- a/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx +++ b/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx @@ -13,7 +13,10 @@ import Breadcrumb from '../../../components/organisms/Breadcrumb' import Honkai3rdNavigator from '../../../components/organisms/Honkai3rdNavigator' import { BattlesuitData, + battlesuitFeatures, BattlesuitSkillGroup, + battlesuitTypes, + valkyries, } from '../../../lib/honkai3rd/battlesuits' import { generateI18NPaths, getI18NProps } from '../../../server/i18n' import { @@ -22,6 +25,8 @@ import { } from '../../../server/data/honkai3rd/battlesuits' import { translate, useTranslation } from '../../../lib/i18n' import { useRouter } from 'next/router' +import Head from '../../../components/atoms/Head' +import { capitalize } from '../../../lib/string' interface BattlesuitShowPageProps { battlesuit: BattlesuitData @@ -37,8 +42,44 @@ const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => { battlesuit.name ) + const { label: valkyrieLabel, krLabel } = valkyries.find( + (aValkyrie) => aValkyrie.value === battlesuit.valkyrie + ) || { label: battlesuit.valkyrie, krLabel: battlesuit.valkyrie } + + const valkyrieName = translate(locale, { 'ko-KR': krLabel }, valkyrieLabel) + + const battlesuitType = battlesuitTypes.find( + (aType) => aType.value === battlesuit.type + ) + const battlesuitTypeLabel = battlesuitType + ? translate( + locale, + { 'ko-KR': battlesuitType.krLabel }, + battlesuitType.label + ) + : capitalize(battlesuit.type) + return ( + { + const featureData = battlesuitFeatures.find( + (aFeature) => aFeature.value === feature + ) + if (featureData == null) { + return feature + } + + const { label, krLabel } = featureData + + return translate(locale, { 'ko-KR': krLabel }, label) + }) + .join(', ')}`} + /> diff --git a/src/pages/honkai3rd/battlesuits/index.tsx b/src/pages/honkai3rd/battlesuits/index.tsx index 352163f0..fd34deef 100644 --- a/src/pages/honkai3rd/battlesuits/index.tsx +++ b/src/pages/honkai3rd/battlesuits/index.tsx @@ -17,6 +17,7 @@ import { useRouter } from 'next/router' import { NextPageContext } from 'next' import { getI18NProps } from '../../../server/i18n' import { translate, useTranslation } from '../../../lib/i18n' +import Head from '../../../components/atoms/Head' type BattlesuitListItemData = Pick< BattlesuitData, @@ -77,6 +78,12 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => { return ( + diff --git a/src/pages/honkai3rd/elfs/[elfId].tsx b/src/pages/honkai3rd/elfs/[elfId].tsx index 46ddb8c8..e69a7b52 100644 --- a/src/pages/honkai3rd/elfs/[elfId].tsx +++ b/src/pages/honkai3rd/elfs/[elfId].tsx @@ -12,6 +12,8 @@ import { getElfById, listElfs } from '../../../server/data/honkai3rd/elfs' import { generateI18NPaths, getI18NProps } from '../../../server/i18n' import { translate, useTranslation } from '../../../lib/i18n' import { useRouter } from 'next/router' +import Head from '../../../components/atoms/Head' +import { battlesuitFeatures } from '../../../lib/honkai3rd/battlesuits' interface ElfShowPageProps { elf: ElfData } @@ -24,6 +26,25 @@ const ElfShowPage = ({ elf }: ElfShowPageProps) => { return ( + { + const featureData = battlesuitFeatures.find( + (aFeature) => aFeature.value === feature + ) + if (featureData == null) { + return feature + } + + const { label, krLabel } = featureData + + return translate(locale, { 'ko-KR': krLabel }, label) + }) + .join(', ')}`} + /> diff --git a/src/pages/honkai3rd/elfs/index.tsx b/src/pages/honkai3rd/elfs/index.tsx index c52ab08e..15fde08d 100644 --- a/src/pages/honkai3rd/elfs/index.tsx +++ b/src/pages/honkai3rd/elfs/index.tsx @@ -9,6 +9,7 @@ import { ElfData } from '../../../lib/honkai3rd/elfs' import { getI18NProps } from '../../../server/i18n' import { listElfs } from '../../../server/data/honkai3rd/elfs' import { useTranslation } from '../../../lib/i18n' +import Head from '../../../components/atoms/Head' interface ElfListPageProps { elfs: Pick[] @@ -19,6 +20,13 @@ const ElfListPage = ({ elfs }: ElfListPageProps) => { return ( + + diff --git a/src/pages/honkai3rd/index.tsx b/src/pages/honkai3rd/index.tsx index a45ba9cd..76699533 100644 --- a/src/pages/honkai3rd/index.tsx +++ b/src/pages/honkai3rd/index.tsx @@ -10,6 +10,7 @@ import PageLink from '../../components/atoms/PageLink' import SquareImageBox from '../../components/atoms/SquareImageBox' import { mdiGithub } from '@mdi/js' import { Icon } from '@mdi/react' +import Head from '../../components/atoms/Head' const bannerValkyries = [ 'kiana', @@ -43,6 +44,10 @@ const Honkai3rdIndexPage = () => { return ( + diff --git a/src/pages/honkai3rd/stigmata/index.tsx b/src/pages/honkai3rd/stigmata/index.tsx index 0f657314..99ce06bc 100644 --- a/src/pages/honkai3rd/stigmata/index.tsx +++ b/src/pages/honkai3rd/stigmata/index.tsx @@ -16,6 +16,7 @@ import { listStigmataSet, } from '../../../server/data/honkai3rd/stigmata' import { useTranslation } from 'next-i18next' +import Head from '../../../components/atoms/Head' interface StigmataListPageProps { stigmataDataList: Pick[] @@ -38,6 +39,12 @@ const StigmataListPage = ({ return ( + diff --git a/src/pages/honkai3rd/versions/[versionId].tsx b/src/pages/honkai3rd/versions/[versionId].tsx index 60a929fe..08982efd 100644 --- a/src/pages/honkai3rd/versions/[versionId].tsx +++ b/src/pages/honkai3rd/versions/[versionId].tsx @@ -23,6 +23,7 @@ import { VersionData } from '../../../lib/honkai3rd/versions' import { generateI18NPaths, getI18NProps } from '../../../server/i18n' import { translate, useTranslation } from '../../../lib/i18n' import { useRouter } from 'next/router' +import Head from '../../../components/atoms/Head' interface VersionShowPageProps { versionData: VersionData @@ -42,6 +43,26 @@ const VersionShowPage = ({ return ( + { + return translate( + locale, + { 'ko-KR': battlesuit.krName }, + battlesuit.name + ) + }) + .join(',')} / ${t('versions.new-weapons')}: ${weapons + .map((weapon) => { + return translate(locale, { 'ko-KR': weapon.krName }, weapon.name) + }) + .join(',')}`} + /> diff --git a/src/pages/honkai3rd/versions/index.tsx b/src/pages/honkai3rd/versions/index.tsx index cf751179..c9f0c289 100644 --- a/src/pages/honkai3rd/versions/index.tsx +++ b/src/pages/honkai3rd/versions/index.tsx @@ -23,6 +23,7 @@ import { getI18NProps } from '../../../server/i18n' import { NextPageContext } from 'next' import { useTranslation, translate } from '../../../lib/i18n' import { useRouter } from 'next/router' +import Head from '../../../components/atoms/Head' interface VersionIndexPageProps { versionDataList: VersionData[] @@ -44,6 +45,13 @@ const VersionIndexPage = ({ return ( + + diff --git a/src/pages/honkai3rd/weapons/[weaponId].tsx b/src/pages/honkai3rd/weapons/[weaponId].tsx index ae78ee36..f968908f 100644 --- a/src/pages/honkai3rd/weapons/[weaponId].tsx +++ b/src/pages/honkai3rd/weapons/[weaponId].tsx @@ -12,6 +12,7 @@ import { } from '../../../server/data/honkai3rd/weapons' import { useRouter } from 'next/router' import { useTranslation, translate } from '../../../lib/i18n' +import Head from '../../../components/atoms/Head' interface WeaponShowPageProps { weapon: WeaponData @@ -22,9 +23,18 @@ const WeaponShowPage = ({ weapon }: WeaponShowPageProps) => { const { t } = useTranslation() const weaponName = translate(locale, { 'ko-KR': weapon.krName }, weapon.name) + const weaponCategory = t(`weapons-show.${weapon.category}`) return ( + @@ -51,7 +61,7 @@ const WeaponShowPage = ({ weapon }: WeaponShowPageProps) => { - {t(`weapons-show.${weapon.category}`)} + {weaponCategory} {'⭐'.repeat(weapon.rarity)} diff --git a/src/pages/honkai3rd/weapons/index.tsx b/src/pages/honkai3rd/weapons/index.tsx index 14a9ec05..fe2dd201 100644 --- a/src/pages/honkai3rd/weapons/index.tsx +++ b/src/pages/honkai3rd/weapons/index.tsx @@ -12,6 +12,7 @@ import WeaponCard from '../../../components/molecules/WeaponCard' import { getI18NProps } from '../../../server/i18n' import { NextPageContext } from 'next' import { useTranslation, translate } from '../../../lib/i18n' +import Head from '../../../components/atoms/Head' type WeaponListItemData = Pick< WeaponData, @@ -56,6 +57,12 @@ const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => { return ( + diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 19cb444f..fce3ba5d 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -3,10 +3,12 @@ import { Box, Text } from '@theme-ui/components' import PageLink from '../components/atoms/PageLink' import Image from 'next/image' import RootNavigator from '../components/organisms/RootNavigator' +import Head from '../components/atoms/Head' const IndexPage = () => { return ( +