Remove [...id].astro, use _redirects 200 proxy

This commit is contained in:
Obsidian Sync 2026-02-25 19:31:09 +05:30
parent 8d707b6683
commit 95302075ef
2 changed files with 15 additions and 24 deletions

View file

@ -1,23 +0,0 @@
---
import { getCollection } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
// Generate paths for both /blog/slug and /slug
const paths = [];
for (const post of posts) {
// /blog/slug - the original path
paths.push({
params: { id: post.id },
props: { slug: post.id },
});
}
return paths;
}
const { slug } = Astro.props;
return Astro.redirect(`/blog/${slug}`, 301);
---