Skip to content

Commit e2f288b

Browse files
committed
Added Homepage redirect
1 parent 3ecc9c9 commit e2f288b

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

next.config.js

-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
module.exports = {
2-
async redirects() {
3-
return [
4-
{
5-
source: '/',
6-
destination: '/docs',
7-
permanent: true,
8-
},
9-
];
10-
},
112
env: {
123
customKey: 'my-value',
134
},

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"dev": "yarn markdown:build && next dev -p 3010",
77
"build": "yarn markdown:build && next build",
8-
"deploy": "next build && next export && git add out/ && git commit -m \"Deploy gh-pages\" && git subtree push --prefix out origin gh-pages",
8+
"deploy": "next build && next export && touch out/.nojekyll && git add out/ && git commit -m \"Deploy gh-pages\" && git subtree push --prefix out origin gh-pages",
99
"start": "next start",
1010
"lint": "next lint",
1111
"markdown:build": "ts-node --project ./node.tsconfig.json ./src/scripts/BuildMarkdownData.ts"

src/pages/index.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, { FC, useEffect } from 'react';
2+
import Router from 'next/router';
3+
4+
const HomePage: FC = () => {
5+
useEffect(() => {
6+
const { pathname } = Router;
7+
if (pathname == '/') {
8+
Router.push('/hello-nextjs');
9+
}
10+
});
11+
return null;
12+
};
13+
14+
export default HomePage;

0 commit comments

Comments
 (0)