diff --git a/app/[locale]/components/Footer/Footer.tsx b/app/[locale]/components/Footer/Footer.tsx index 31f9ee8..eddacbc 100644 --- a/app/[locale]/components/Footer/Footer.tsx +++ b/app/[locale]/components/Footer/Footer.tsx @@ -3,6 +3,7 @@ import Link from 'next/link' import styles from './Footer.module.css' import { useTranslations } from 'next-intl' +import { docsRedirect } from '@/docsRedirect' const Footer = () => { const t = useTranslations('footer') @@ -18,9 +19,9 @@ const Footer = () => { { title: t('development'), links: [ - { href: 'https://docs.openwebgal.com/', label: t('gameDevelopDoc') }, - { href: 'https://docs.openwebgal.com/developers', label: t('contribute') }, - { href: 'https://docs.openwebgal.com/tech', label: t('technical') } + { href: docsRedirect('/'), label: t('gameDevelopDoc') }, + { href: docsRedirect('/developers'), label: t('contribute') }, + { href: docsRedirect('/tech'), label: t('technical') } ], }, { @@ -40,7 +41,7 @@ const Footer = () => { { title: t('sponsor'), links: [ - { href: 'https://docs.openwebgal.com/sponsor/', label: t('sponsor') }, + { href: docsRedirect('/sponsor'), label: t('sponsor') }, ], }, ] diff --git a/app/[locale]/components/Navbar/Nav.tsx b/app/[locale]/components/Navbar/Nav.tsx index 5ffe3fd..4071847 100644 --- a/app/[locale]/components/Navbar/Nav.tsx +++ b/app/[locale]/components/Navbar/Nav.tsx @@ -2,6 +2,7 @@ import { RiMenuFill } from 'react-icons/ri' import styles from './Nav.module.css' import Link from 'next/link' import { useTranslations } from 'next-intl' +import { docsRedirect } from '@/docsRedirect' const Nav = ({ locale, pathname }: { locale: string, pathname: string }) => { @@ -11,7 +12,7 @@ const Nav = ({ locale, pathname }: { locale: string, pathname: string }) => { { label: t('home'), href: `/${locale}/` }, { label: t('download'), href: `/${locale}/download/` }, { label: t('demo'), href: 'https://demo.openwebgal.com/' }, - { label: t('document'), href: 'https://docs.openwebgal.com/' }, + { label: t('document'), href: docsRedirect('/') }, { label: t('games'), href: `/${locale}/games/` } ] diff --git a/app/[locale]/components/TopVisual/TopVisual.tsx b/app/[locale]/components/TopVisual/TopVisual.tsx index afd35dd..da71d83 100644 --- a/app/[locale]/components/TopVisual/TopVisual.tsx +++ b/app/[locale]/components/TopVisual/TopVisual.tsx @@ -4,6 +4,7 @@ import Link from 'next/link' import styles from './TopVisual.module.css' import Image from 'next/image' import { useEffect, useState } from 'react' +import { docsRedirect } from '@/docsRedirect' const TopVisual = () => { const t = useTranslations('home') @@ -20,11 +21,6 @@ const TopVisual = () => { }, ] - // Depending on the language type of the browser, get the URL of docs - const docsURL = () => { - return `https://docs.openwebgal.com${ locale === 'zh-cn' ? '' : `/${locale}/` }` - } - const [topVisualImageIndex, setTopVisualImageIndex] = useState(0) useEffect(() => { @@ -55,7 +51,7 @@ const TopVisual = () => { {t('nowDownload')} diff --git a/app/[locale]/components/WebGALGames/WebGALGames.tsx b/app/[locale]/components/WebGALGames/WebGALGames.tsx index 12dc212..0fbf463 100644 --- a/app/[locale]/components/WebGALGames/WebGALGames.tsx +++ b/app/[locale]/components/WebGALGames/WebGALGames.tsx @@ -1,6 +1,7 @@ import Button from '@/app/components/Button/Button' import GameCard from '@/app/components/GameCard/GameCard' import { gamesData, homeGamesId } from '@/data/gamesData' +import { docsRedirect } from '@/docsRedirect' import { gamesDataSort } from '@/utils' import { useLocale, useTranslations } from 'next-intl' import Link from 'next/link' @@ -9,11 +10,6 @@ const WebGALGames = () => { const t = useTranslations('games') const locale = useLocale() - // Depending on the language type of the browser, get the URL of showcase-your-game - const showcaseYourGameURL = () => { - return `https://docs.openwebgal.com${ locale === 'zh-cn' ? '' : `/${locale}` }/guide/showcase-your-game` - } - return (
@@ -31,7 +27,7 @@ const WebGALGames = () => {