fix: normalize BASE_URL trailing slash in post links and RSS feed
The Astro BASE_URL (/crashtestdev) lacked a trailing slash, causing post URLs to render as /crashtestdevposts/... instead of /crashtestdev/posts/... Breaking article card navigation and RSS feed links. Applied the same .replace(/\/?$/, '/') normalization pattern already used in BaseLayout.astro to: - ArticleCard.astro (card link hrefs) - NavBar.astro (isActive path matching) - rss.xml.ts (item link generation) Also adds final-verification.test.mjs with 31 tests covering: - Clean build output structure - Index page cards, shadows, hover states, URL format - Post page NavBar active state, PostHeader centering - Three typography voices (prose/structure/evidence) - Code block breakout width, warm background, terracotta border - Design token color compliance - Responsive behavior (nav stacking, title shrinking, gutter respect) - RSS feed validity and URL correctness
This commit is contained in:
@@ -4,7 +4,7 @@ import type { APIContext } from 'astro';
|
||||
|
||||
export async function GET(context: APIContext) {
|
||||
const posts = await getCollection('posts');
|
||||
const base = import.meta.env.BASE_URL;
|
||||
const base = import.meta.env.BASE_URL.replace(/\/?$/, '/');
|
||||
|
||||
const sortedPosts = posts.sort(
|
||||
(a, b) => b.data.date.getTime() - a.data.date.getTime()
|
||||
|
||||
Reference in New Issue
Block a user