Skip to content

Commit f86d3a4

Browse files
committed
fix: base url for dynamic routing
1 parent e45cc54 commit f86d3a4

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/components/Sidebar.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ interface Props {
88
99
const { currentSlug, isHome = false } = Astro.props;
1010
const notes = getNotes();
11+
const base = import.meta.env.BASE_URL;
1112
---
1213

1314
<button class="qn-hamburger" id="hamburger" aria-label="Open menu">☰</button>
1415
<div class="qn-sidebar-overlay" id="overlay"></div>
1516

1617
<nav class="qn-sidebar" id="sidebar">
1718
<div class="qn-sidebar-logo">
18-
<a href="/">
19+
<a href={base}>
1920
<div class="logo-tag">Interactive Notes</div>
2021
<div class="logo-title">Quantum<br>Computing</div>
2122
</a>
@@ -24,7 +25,7 @@ const notes = getNotes();
2425
<div class="qn-nav">
2526
<div class="qn-nav-section-label">Navigation</div>
2627

27-
<a class={`qn-nav-item ${isHome ? 'active' : ''}`} href="/">
28+
<a class={`qn-nav-item ${isHome ? 'active' : ''}`} href={base}>
2829
<div class="qn-nav-item-header">
2930
<span class="qn-nav-item-num">🏠</span>
3031
<span class="qn-nav-item-label">Home</span>
@@ -46,15 +47,15 @@ const notes = getNotes();
4647
</div>
4748
<div class="qn-subnav">
4849
{note.sections.map(s => (
49-
<a href={`/notes/${note.slug}#${s.id}`}>{s.label}</a>
50+
<a href={`${base}notes/${note.slug}#${s.id}`}>{s.label}</a>
5051
))}
5152
</div>
5253
</div>
5354
))}
5455

5556
<div class="qn-nav-section-label" style="margin-top:0.5rem;">Labs</div>
5657

57-
<a class={`qn-nav-item ${currentSlug === 'sandbox' ? 'active' : ''}`} href="/sandbox">
58+
<a class={`qn-nav-item ${currentSlug === 'sandbox' ? 'active' : ''}`} href={`${base}sandbox`}>
5859
<div class="qn-nav-item-header">
5960
<span class="qn-nav-item-num">⚛</span>
6061
<span class="qn-nav-item-label">Circuit Sandbox</span>

src/pages/index.astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { getNotes, getNoteColor } from '../lib/notes';
44
import '../styles/home.css';
55
66
const notes = getNotes();
7+
const base = import.meta.env.BASE_URL;
78
---
89

910
<BaseLayout title="Quantum Computing — Interactive Notes" isHome={true}>
@@ -38,7 +39,7 @@ const notes = getNotes();
3839
<div class="cards-grid">
3940

4041
{notes.map(note => (
41-
<a class="note-card" href={`/notes/${note.slug}`} style={`--card-color:${getNoteColor(note.order)};`}>
42+
<a class="note-card" href={`${base}notes/${note.slug}`} style={`--card-color:${getNoteColor(note.order)};`}>
4243
<div class="note-card-num">Note {String(note.order).padStart(2,'0')} · {note.title}</div>
4344
<h3 set:html={note.title} />
4445
<p>{note.description}</p>
@@ -48,7 +49,7 @@ const notes = getNotes();
4849
</a>
4950
))}
5051

51-
<a class="sandbox-card" href="/sandbox">
52+
<a class="sandbox-card" href={`${base}sandbox`}>
5253
<div class="note-card-num">Interactive Lab</div>
5354
<h3>⚛ Circuit Sandbox</h3>
5455
<p>Drag-and-drop quantum circuit editor — up to 4 qubits, 8 moments. Live probability outcomes, preset circuits, Bloch sphere display.</p>
@@ -65,7 +66,7 @@ const notes = getNotes();
6566
<div class="concepts-grid">
6667
{notes.map(note =>
6768
note.sections.map(s => (
68-
<a class="concept-item" href={`/notes/${note.slug}#${s.id}`}>
69+
<a class="concept-item" href={`${base}notes/${note.slug}#${s.id}`}>
6970
<strong>{s.label}</strong>
7071
<span>Note {String(note.order).padStart(2,'0')} · §{s.id.replace('s','')}</span>
7172
</a>

0 commit comments

Comments
 (0)