🥅(frontend) improve meta 401 page

Add better meta for the 401 page.
This commit is contained in:
Anthony LC
2025-09-17 14:53:21 +02:00
parent d8c9283dd1
commit b773f09792
2 changed files with 41 additions and 23 deletions

View File

@@ -93,6 +93,12 @@ test.describe('Doc Routing', () => {
await expect(page.getByText('Log in to access the document.')).toBeVisible({ await expect(page.getByText('Log in to access the document.')).toBeVisible({
timeout: 10000, timeout: 10000,
}); });
await expect(page.locator('meta[name="robots"]')).toHaveAttribute(
'content',
'noindex',
);
await expect(page).toHaveTitle(/401 Unauthorized - Docs/);
}); });
}); });

View File

@@ -1,4 +1,5 @@
import { Button } from '@openfun/cunningham-react'; import { Button } from '@openfun/cunningham-react';
import Head from 'next/head';
import Image from 'next/image'; import Image from 'next/image';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { ReactElement, useEffect } from 'react'; import { ReactElement, useEffect } from 'react';
@@ -22,6 +23,16 @@ const Page: NextPageWithLayout = () => {
}, [authenticated, replace]); }, [authenticated, replace]);
return ( return (
<>
<Head>
<meta name="robots" content="noindex" />
<title>{`${t('401 Unauthorized')} - ${t('Docs')}`}</title>
<meta
property="og:title"
content={`${t('401 Unauthorized')} - ${t('Docs')}`}
key="title"
/>
</Head>
<Box <Box
$align="center" $align="center"
$margin="auto" $margin="auto"
@@ -48,6 +59,7 @@ const Page: NextPageWithLayout = () => {
</Button> </Button>
</Box> </Box>
</Box> </Box>
</>
); );
}; };