Remove [...id].astro, use _redirects 200 proxy
This commit is contained in:
parent
8d707b6683
commit
95302075ef
2 changed files with 15 additions and 24 deletions
|
|
@ -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);
|
||||
---
|
||||
Loading…
Add table
Add a link
Reference in a new issue