Homestays 301 fix
This commit is contained in:
@@ -12,6 +12,10 @@ export async function load({ params }) {
|
|||||||
throw redirect(301, '/contact-us');
|
throw redirect(301, '/contact-us');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.slug === 'home-stays') {
|
||||||
|
throw redirect(301, '/');
|
||||||
|
}
|
||||||
|
|
||||||
const slug = params.slug as StaticPageSlug;
|
const slug = params.slug as StaticPageSlug;
|
||||||
const generalEnquiryEnabled = isGeneralEnquiryEnabled();
|
const generalEnquiryEnabled = isGeneralEnquiryEnabled();
|
||||||
const sourcePage = staticPages[slug];
|
const sourcePage = staticPages[slug];
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ describe('static slug page server load', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('redirects the legacy home-stays slug to the homepage', async () => {
|
||||||
|
await expect(load({ params: { slug: 'home-stays' } } as never)).rejects.toMatchObject({
|
||||||
|
status: 301,
|
||||||
|
location: '/'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('throws a 404 for unknown slugs', async () => {
|
it('throws a 404 for unknown slugs', async () => {
|
||||||
await expect(load({ params: { slug: 'missing-page' } } as never)).rejects.toMatchObject({
|
await expect(load({ params: { slug: 'missing-page' } } as never)).rejects.toMatchObject({
|
||||||
status: 404
|
status: 404
|
||||||
|
|||||||
Reference in New Issue
Block a user