Skip to content

Commit 5f965d9

Browse files
committed
modified: app/en/page.tsx
modified: app/ja/page.tsx new file: app/lib/paths.ts modified: app/page.tsx modified: data/publications.json
1 parent afe5e1d commit 5f965d9

File tree

5 files changed

+47
-14
lines changed

5 files changed

+47
-14
lines changed

app/en/page.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import LangSwitch from '../components/LangSwitch';
22
import SideToc from '../components/SideToc';
33
import Link from 'next/link';
44
import { getDict } from '../lib/i18n';
5+
import { withBase } from '../lib/paths';
6+
import Image from 'next/image';
57

68
export default function HomePageEN() {
79
const t = getDict('en');
@@ -13,9 +15,10 @@ export default function HomePageEN() {
1315
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
1416
<nav className="nav">
1517
<a href="#home">{t.nav.home}</a>
16-
<Link href="/en/publication">{t.nav.publications}</Link>
1718
<a href="#research">{t.nav.research}</a>
18-
<a href="#courses">{t.nav.courses}</a>
19+
<Link href="/en/publication">{t.nav.publications}</Link>
20+
<a href="#students">{t.nav.students}</a>
21+
<a href="#contact">{t.nav.contact}</a>
1922
</nav>
2023
<LangSwitch />
2124
</div>
@@ -41,7 +44,7 @@ export default function HomePageEN() {
4144
<h2 className="section-title">{t.about.title}</h2>
4245
<div className="about-grid">
4346
<div className="about-photo">
44-
<img src="/wang_hao.jpeg" alt="Hao WANG" />
47+
<Image src="/wang_hao.jpeg" alt="Hao WANG" width={300} height={300} style={{ width: '100%', height: 'auto' }} />
4548
</div>
4649
<div>
4750
{t.profile && t.profile.name && Array.isArray(t.profile.lines) && (
@@ -150,7 +153,7 @@ export default function HomePageEN() {
150153
{r.map((cell: any, cidx: number) => (
151154
<td key={cidx}>
152155
{cell && typeof cell === 'object' && 'href' in cell ? (
153-
<a href={cell.href} target="_blank" rel="noopener noreferrer">{cell.text}</a>
156+
<a href={withBase(cell.href)} target="_blank" rel="noopener noreferrer">{cell.text}</a>
154157
) : (
155158
cell
156159
)}
@@ -181,8 +184,8 @@ export default function HomePageEN() {
181184

182185
<SideToc items={[
183186
{ id: 'home', label: t.nav.home },
184-
{ id: 'courses', label: t.nav.courses },
185187
{ id: 'research', label: t.nav.research },
188+
{ id: 'courses', label: t.nav.courses },
186189
{ id: 'expectations', label: t.nav.expectations },
187190
{ id: 'insights', label: t.nav.insights },
188191
{ id: 'students', label: t.nav.students },

app/ja/page.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import LangSwitch from '../components/LangSwitch';
22
import Link from 'next/link';
33
import SideToc from '../components/SideToc';
44
import { getDict } from '../lib/i18n';
5+
import { withBase } from '../lib/paths';
6+
import Image from 'next/image';
57

68
export default function HomePageJA() {
79
const t = getDict('ja');
@@ -13,9 +15,10 @@ export default function HomePageJA() {
1315
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
1416
<nav className="nav">
1517
<a href="#home">{t.nav.home}</a>
16-
<Link href="/ja/publication">{t.nav.publications}</Link>
1718
<a href="#research">{t.nav.research}</a>
18-
<a href="#courses">{t.nav.courses}</a>
19+
<Link href="/ja/publication">{t.nav.publications}</Link>
20+
<a href="#students">{t.nav.students}</a>
21+
<a href="#contact">{t.nav.contact}</a>
1922
</nav>
2023
<LangSwitch />
2124
</div>
@@ -40,7 +43,7 @@ export default function HomePageJA() {
4043

4144
<div className="about-grid ">
4245
<div className="about-photo">
43-
<img src="/wang_hao.jpeg" alt="Hao WANG" />
46+
<Image src="/wang_hao.jpeg" alt="Hao WANG" width={300} height={300} style={{ width: '100%', height: 'auto' }} />
4447
</div>
4548
<div>
4649
{t.profile && t.profile.name && Array.isArray(t.profile.lines) && (
@@ -150,7 +153,7 @@ export default function HomePageJA() {
150153
{r.map((cell: any, cidx: number) => (
151154
<td key={cidx}>
152155
{cell && typeof cell === 'object' && 'href' in cell ? (
153-
<a href={cell.href} target="_blank" rel="noopener noreferrer">{cell.text}</a>
156+
<a href={withBase(cell.href)} target="_blank" rel="noopener noreferrer">{cell.text}</a>
154157
) : (
155158
cell
156159
)}
@@ -181,8 +184,8 @@ export default function HomePageJA() {
181184

182185
<SideToc items={[
183186
{ id: 'home', label: t.nav.home },
184-
{ id: 'courses', label: t.nav.courses },
185187
{ id: 'research', label: t.nav.research },
188+
{ id: 'courses', label: t.nav.courses },
186189
{ id: 'expectations', label: t.nav.expectations },
187190
{ id: 'insights', label: t.nav.insights },
188191
{ id: 'students', label: t.nav.students },

app/lib/paths.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export function withBase(path: string): string {
2+
const base = process.env.NEXT_PUBLIC_BASE_PATH || '';
3+
if (!path) return base;
4+
// Normalize: ensure leading slash for relative assets in public
5+
const normalized = path.startsWith('/') ? path : `/${path}`;
6+
// If already has base prefix, avoid duplicating
7+
if (base && normalized.startsWith(base + '/')) return normalized;
8+
return `${base}${normalized}`;
9+
}
10+
11+

app/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import LangSwitch from './components/LangSwitch';
22
import Link from 'next/link';
33
import SideToc from './components/SideToc';
44
import { getDict } from './lib/i18n';
5+
import { withBase } from './lib/paths';
6+
import Image from 'next/image';
57

68
export default function HomePage() {
79
const t = getDict('zh');
@@ -12,7 +14,7 @@ export default function HomePage() {
1214
<div className="brand"><Link href="/">{t.brand}</Link></div>
1315
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
1416
<nav className="nav">
15-
<a href="/">{t.nav.home}</a>
17+
<a href="#home">{t.nav.home}</a>
1618
<a href="#research">{t.nav.research}</a>
1719
<Link href="/publication">{t.nav.publications}</Link>
1820
<a href="#students">{t.nav.students}</a>
@@ -42,7 +44,7 @@ export default function HomePage() {
4244
<h2 className="section-title">{t.about.title}</h2>
4345
<div className="about-grid">
4446
<div className="about-photo">
45-
<img src="/wang_hao.jpeg" alt="Hao WANG" />
47+
<Image src="/wang_hao.jpeg" alt="Hao WANG" width={300} height={300} style={{ width: '100%', height: 'auto' }} />
4648
</div>
4749
<div>
4850
{t.profile && t.profile.name && Array.isArray(t.profile.lines) && (
@@ -152,7 +154,7 @@ export default function HomePage() {
152154
{r.map((cell: any, cidx: number) => (
153155
<td key={cidx}>
154156
{cell && typeof cell === 'object' && 'href' in cell ? (
155-
<a href={cell.href} target="_blank" rel="noopener noreferrer">{cell.text}</a>
157+
<a href={withBase(cell.href)} target="_blank" rel="noopener noreferrer">{cell.text}</a>
156158
) : (
157159
cell
158160
)}
@@ -183,8 +185,8 @@ export default function HomePage() {
183185

184186
<SideToc items={[
185187
{ id: 'home', label: t.nav.home },
186-
{ id: 'courses', label: t.nav.courses },
187188
{ id: 'research', label: t.nav.research },
189+
{ id: 'courses', label: t.nav.courses },
188190
{ id: 'expectations', label: t.nav.expectations },
189191
{ id: 'insights', label: t.nav.insights },
190192
{ id: 'students', label: t.nav.students },

data/publications.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@
4646
"year": 2025,
4747
"url": "https://escholarship.org/content/qt6mx1z1r4/qt6mx1z1r4.pdf"
4848
},
49+
{
50+
"id": "zhang2025infodesignlm",
51+
"type": "inproceedings",
52+
"title": "InfoDesignLM: An LLM for Interactive and Controllable Infographic Designing Through Text",
53+
"authors": [
54+
"Zhang, Xilin",
55+
"Wang, Hao",
56+
"Dai, Jianbiao",
57+
"Zhu, Pinpin"
58+
],
59+
"abbr": "ICDAR",
60+
"booktitle": "Proceedings of the International Conference on Document Analysis and Recognition (ICDAR, CCF-C)",
61+
"year": 2025
62+
},
4963
{
5064
"id": "wang2025hidreader",
5165
"type": "inproceedings",

0 commit comments

Comments
 (0)