feat(blog): add redirect to 404 page if entry is not found
This commit adds a redirect to the 404 page if the entry is not found. This ensures that users are directed to the appropriate page when accessing a non-existent blog entry.
This commit is contained in:
parent
0028c52496
commit
6cd32df0ee
@ -21,6 +21,11 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { entry } = Astro.props as Props;
|
const { entry } = Astro.props as Props;
|
||||||
|
|
||||||
|
if (!entry) {
|
||||||
|
return Astro.redirect('/404');
|
||||||
|
}
|
||||||
|
|
||||||
const { Content } = await entry.render();
|
const { Content } = await entry.render();
|
||||||
const components = { table: Table };
|
const components = { table: Table };
|
||||||
const {
|
const {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user