Created
September 3, 2019 12:59
-
-
Save fwojciec/3d0135265f5551863f9dd85983faa9b7 to your computer and use it in GitHub Desktop.
How to build a multilingual website in Next.js #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/index.tsx | |
import React from 'react' | |
import Head from 'next/head' | |
import { getInitialLocale } from '../translations/getInitialLocale' | |
import { useRouter } from 'next/dist/client/router' | |
const Index: React.FC = () => { | |
const router = useRouter() | |
React.useEffect(() => { | |
router.replace('/[lang]', `/${getInitialLocale()}`) | |
}) | |
return ( | |
<Head> | |
<meta name="robots" content="noindex, nofollow" /> | |
</Head> | |
) | |
} | |
export default Index |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment