Skip to content

Commit 88610f2

Browse files
vweeksclaude
andcommitted
Fix nav link base-path concatenation
Astro's BASE_URL was missing the trailing slash, so templates like `${BASE_URL}framework/` rendered as `/scientific-agentic-engineeringframework/` and broke in-site navigation on the deployed subpath. Normalize `base` in astro.config.mjs to end with `/` and drop the compensating leading slash in BaseLayout's favicon href. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: ff13b2224bf4
1 parent 4390e42 commit 88610f2

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import tailwindcss from '@tailwindcss/vite';
55
// https://astro.build/config
66
export default defineConfig({
77
site: 'https://vweeks.github.io',
8-
base: '/scientific-agentic-engineering',
8+
base: '/scientific-agentic-engineering/',
99
vite: {
1010
plugins: [tailwindcss()],
1111
},

docs/development-log.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,32 @@ The 3-commit structure from the plan proved its value immediately: if the deploy
403403

404404
---
405405

406+
## Session 3 — 2026-04-15: Post-Deploy Bug Fixes
407+
408+
### Interaction 15: Nav Link Slash Bug (Base Path Concatenation)
409+
410+
**Human prompt (paraphrased):**
411+
> On the live site, clicking a nav link breaks it because the URL doesn't preserve the `/` between the base path and the route.
412+
413+
**What the AI did:**
414+
- Reproduced the issue by inspecting built HTML in `dist/index.html`: hrefs were rendering as `/scientific-agentic-engineeringframework/` (no slash between base and route)
415+
- Traced the cause to `astro.config.mjs` using `base: '/scientific-agentic-engineering'` (no trailing slash), combined with templates like `${import.meta.env.BASE_URL}framework/` that assume the base ends in `/`
416+
- Noted an internal inconsistency: `BaseLayout.astro` had already worked around the problem with `${BASE_URL}/favicon.svg` (leading slash on the path), while `Nav.astro`, `Hero.astro`, `pages/index.astro`, and `pages/framework/index.astro` assumed the opposite convention
417+
- Fixed by (a) adding the trailing slash to `base` in `astro.config.mjs` so all templates compose correctly, and (b) removing the now-redundant leading slash in the `BaseLayout.astro` favicon line to avoid `//favicon.svg`
418+
- Rebuilt and verified all hrefs render as `/scientific-agentic-engineering/framework/` (with the slash)
419+
420+
**Key findings/output:**
421+
- Astro 6 does **not** auto-normalize `import.meta.env.BASE_URL` to end with a trailing slash — it reflects the configured `base` literally. This differs from some older Astro documentation examples and is a realistic papercut for projects deployed under a subpath.
422+
- The bug was invisible on the home page itself (which loads at the base URL directly) and only surfaced on *clicks* into subpaths — a reminder that automated CI builds passing ≠ the site works as users would use it. The `npm run build` and GitHub Pages deploy both succeeded in Session 2; the defect was latent.
423+
424+
**Human decisions:**
425+
- Chose to fix at the config level (add trailing slash to `base`) rather than patch each template — a convention-at-the-source fix so future templates compose correctly by default
426+
427+
**Observation:**
428+
This is the first post-deploy defect in the project, and it exposes a gap in Session 2's verification: the dev-server smoke test (Interaction 11) and the deploy verification (Interaction 14) both confirmed the site *loaded*, not that in-site navigation worked. A more complete smoke test would click through each top-level nav link. This is a small but worth-keeping example of the difference between "builds + serves HTTP 200" and "functions for a user," which is directly relevant to the fellowship's broader theme of how AI-assisted workflows should define "done."
429+
430+
---
431+
406432
## Template for Future Entries
407433

408434
```markdown

src/layouts/BaseLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const { title, description = 'Scientific Agentic Engineering — methodology for
1515
<html lang="en">
1616
<head>
1717
<meta charset="utf-8" />
18-
<link rel="icon" type="image/svg+xml" href={`${import.meta.env.BASE_URL}/favicon.svg`} />
18+
<link rel="icon" type="image/svg+xml" href={`${import.meta.env.BASE_URL}favicon.svg`} />
1919
<meta name="viewport" content="width=device-width, initial-scale=1" />
2020
<meta name="description" content={description} />
2121
<meta name="generator" content={Astro.generator} />

0 commit comments

Comments
 (0)