Skip to content

Commit 6b6394b

Browse files
committed
Added basepath
1 parent 4c0fa37 commit 6b6394b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

next.config.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
* @type {import('next').NextConfig}
33
*/
44
const nextConfig = {
5-
basePath: "/Next.js-and-GitHub-Pages-Example",
5+
publicRuntimeConfig: {
6+
basePath: "/Next.js-and-GitHub-Pages-Example",
7+
},
68
output: "export",
79
images: {
810
loader: "akamai",

pages/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import type { NextPage } from "next";
22
import Head from "next/head";
33
import Image from "next/image";
44
import styles from "../styles/Home.module.css";
5+
import getConfig from "next/config";
56

67
const Home: NextPage = () => {
8+
const { publicRuntimeConfig } = getConfig();
9+
710
return (
811
<div className={styles.container}>
912
<Head>
@@ -62,7 +65,7 @@ const Home: NextPage = () => {
6265
Powered by{" "}
6366
<span className={styles.logo}>
6467
<Image
65-
src="/Next.js-and-GitHub-Pages-Example/vercel.svg"
68+
src={`${publicRuntimeConfig.basePath}"/vercel.svg"`}
6669
alt="Vercel Logo"
6770
width={72}
6871
height={16}

0 commit comments

Comments
 (0)