Skip to content

Commit

Permalink
Added basepath
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveAldon committed Apr 22, 2024
1 parent 4c0fa37 commit 6b6394b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* @type {import('next').NextConfig}
*/
const nextConfig = {
basePath: "/Next.js-and-GitHub-Pages-Example",
publicRuntimeConfig: {
basePath: "/Next.js-and-GitHub-Pages-Example",
},
output: "export",
images: {
loader: "akamai",
Expand Down
5 changes: 4 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import type { NextPage } from "next";
import Head from "next/head";
import Image from "next/image";
import styles from "../styles/Home.module.css";
import getConfig from "next/config";

const Home: NextPage = () => {
const { publicRuntimeConfig } = getConfig();

return (
<div className={styles.container}>
<Head>
Expand Down Expand Up @@ -62,7 +65,7 @@ const Home: NextPage = () => {
Powered by{" "}
<span className={styles.logo}>
<Image
src="/Next.js-and-GitHub-Pages-Example/vercel.svg"
src={`${publicRuntimeConfig.basePath}"/vercel.svg"`}
alt="Vercel Logo"
width={72}
height={16}
Expand Down

0 comments on commit 6b6394b

Please sign in to comment.