Skip to content

Commit 55c38bb

Browse files
committed
chore: 修改basePath
1 parent ee54726 commit 55c38bb

File tree

9 files changed

+104
-85
lines changed

9 files changed

+104
-85
lines changed

components/code-block/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const CodeBlock: React.FC<CodeBlockProps> = ({ type }) => {
4343
<div className={styles.wrapper}>
4444
<div className={styles.logo}>
4545
<img
46-
src={`/images/${type}.png`}
46+
src={`/fastexcel/images/${type}.png`}
4747
alt="FastExcel"
4848
width={136}
4949
height={40}

components/contributors/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const Contributors: React.FC = () => {
5858
{contributors.map((contributor, index) => (
5959
<div key={index} className={styles.contributorItem}>
6060
<img
61-
src={contributor.avatar}
61+
src={`/fastexcel${contributor.avatar}`}
6262
alt={contributor.name}
6363
className={styles.avatar}
6464
/>

components/features/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const Features: React.FC = () => {
4141
{features.map((feature, index) => (
4242
<div key={index} className={styles.featureCard}>
4343
<Image
44-
src={feature.icon}
44+
src={`/fastexcel${feature.icon}`}
4545
alt={feature.title}
4646
width={40}
4747
height={40}

components/footer/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ import Link from "next/link";
44
import styles from "./index.module.css";
55
import { LanguageSelector } from "../language-switch";
66
import { useTranslation } from '../../hooks/useTranslation';
7+
import { useRouter } from 'next/router';
78

89
const Footer: React.FC = () => {
910
const { t } = useTranslation();
11+
const { basePath } = useRouter();
12+
1013
return (
1114
<footer className={styles.footer}>
1215
<div className={styles.footerContent}>
1316
<div className={styles.logoSection}>
1417
<Link href="/">
1518
<Image
16-
src="/images/logo.svg"
19+
src={`${basePath}/images/logo.svg`}
1720
alt="FastExcel"
1821
width={136}
1922
height={40}

components/index-page/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ import { Contributors } from "../contributors";
77
import { Testimonials } from "../testimonials";
88
import Footer from "../footer";
99
import { useTranslation } from "../../hooks/useTranslation";
10+
import { useRouter } from 'next/router';
11+
import Image from 'next/image';
1012

1113
const IndexPage: React.FC = () => {
1214
const { t } = useTranslation();
15+
const { basePath } = useRouter();
16+
1317
return (
1418
<>
1519
<div className={styles.container}>

components/navbar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useTranslation } from "../../hooks/useTranslation";
77

88
const Navbar = () => {
99
const router = useRouter();
10-
const { locale = "zh-CN" } = router;
10+
const { locale = "zh-CN", basePath } = router;
1111
const { t } = useTranslation();
1212

1313
const isZhCN = locale === "zh-CN";
@@ -17,7 +17,7 @@ const Navbar = () => {
1717
<div className={styles.navContent}>
1818
<Link href="/" className={styles.logoContainer}>
1919
<Image
20-
src="/images/logo.svg"
20+
src={`${basePath}/images/logo.svg`}
2121
alt="FastExcel"
2222
width={136}
2323
height={40}

components/testimonials/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const Testimonials: React.FC = () => {
124124
<div key={`${rowId}-${index}`} className={styles.testimonialCard}>
125125
<div className={styles.testimonialHeader}>
126126
<img
127-
src={testimonial.avatar}
127+
src={`/fastexcel${testimonial.avatar}`}
128128
alt={testimonial.author}
129129
className={styles.avatar}
130130
loading="lazy" // 添加懒加载

next.config.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const withNextra = nextra({
77
});
88

99
export default withNextra({
10-
basePath: "/fastexcel",
10+
basePath: '/fastexcel',
11+
assetPrefix: '/fastexcel',
1112
i18n: {
1213
locales: ["zh-CN", "zh-TW", "en-US", "ja-JP"],
1314
defaultLocale: "zh-CN",
@@ -19,7 +20,18 @@ export default withNextra({
1920
destination: "/en-US/:path*",
2021
permanent: true,
2122
},
23+
{
24+
source: "/",
25+
destination: "/fastexcel/zh-CN/",
26+
permanent: true,
27+
basePath: false
28+
},
29+
{
30+
source: "/fastexcel",
31+
destination: "/fastexcel/zh-CN/",
32+
permanent: true,
33+
basePath: false
34+
}
2235
];
2336
},
24-
2537
});

public/sitemap-0.xml

Lines changed: 76 additions & 76 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)