dh_demo

DreamHanks demo project
git clone git://git.lair.cx/dh_demo
Log | Files | Refs | README

commit 657e4085b559d43ede8b52ee662ae567c54d98e4
parent 0edf920e43cc920ead1d22a7c8259cd97b8fd57d
Author: Yongbin Kim <iam@yongbin.kim>
Date:   Fri, 20 Jan 2023 14:04:05 +0900

feat: 위키 초기 페이지 리다이렉트 추가

Signed-off-by: Yongbin Kim <iam@yongbin.kim>

Diffstat:
Mnext.config.js | 9+++++++++
Apages/wiki/[slug]/index.tsx | 27+++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/next.config.js b/next.config.js @@ -1,6 +1,15 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + async redirects () { + return [ + { + source: '/', + destination: '/home', + permanent: true, + }, + ] + } } module.exports = nextConfig diff --git a/pages/wiki/[slug]/index.tsx b/pages/wiki/[slug]/index.tsx @@ -0,0 +1,27 @@ +import { GetServerSideProps, GetServerSidePropsContext } from 'next' +import Link from 'next/link' + +interface WikiPageProps { + homePath: string +} + +export const getServerSideProps: GetServerSideProps<WikiPageProps> = async (context) => { + const homePath = `${context.resolvedUrl}/${process.env.WIKI_PAGE_ENTRY}` + + return { + redirect: { + destination: homePath, + }, + props: { + homePath + } + } +} + +export default function WikiPage (props: WikiPageProps) { + return ( + <div> + <Link href={props.homePath}>여기</Link>를 눌러 이동하세요. + </div> + ) +}