Skip to content

Commit b773f09

Browse files
committed
🥅(frontend) improve meta 401 page
Add better meta for the 401 page.
1 parent d8c9283 commit b773f09

File tree

2 files changed

+43
-25
lines changed

2 files changed

+43
-25
lines changed

src/frontend/apps/e2e/__tests__/app-impress/doc-routing.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ test.describe('Doc Routing', () => {
9393
await expect(page.getByText('Log in to access the document.')).toBeVisible({
9494
timeout: 10000,
9595
});
96+
97+
await expect(page.locator('meta[name="robots"]')).toHaveAttribute(
98+
'content',
99+
'noindex',
100+
);
101+
await expect(page).toHaveTitle(/401 Unauthorized - Docs/);
96102
});
97103
});
98104

src/frontend/apps/impress/src/pages/401.tsx

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Button } from '@openfun/cunningham-react';
2+
import Head from 'next/head';
23
import Image from 'next/image';
34
import { useRouter } from 'next/router';
45
import { ReactElement, useEffect } from 'react';
@@ -22,32 +23,43 @@ const Page: NextPageWithLayout = () => {
2223
}, [authenticated, replace]);
2324

2425
return (
25-
<Box
26-
$align="center"
27-
$margin="auto"
28-
$gap="1rem"
29-
$padding={{ bottom: '2rem' }}
30-
>
31-
<Image
32-
className="c__image-system-filter"
33-
src={img401}
34-
alt={t('Image 401')}
35-
style={{
36-
maxWidth: '100%',
37-
height: 'auto',
38-
}}
39-
/>
40-
41-
<Box $align="center" $gap="0.8rem">
42-
<Text as="p" $textAlign="center" $maxWidth="350px" $theme="primary">
43-
{t('Log in to access the document.')}
44-
</Text>
45-
46-
<Button onClick={() => gotoLogin(false)} aria-label={t('Login')}>
47-
{t('Login')}
48-
</Button>
26+
<>
27+
<Head>
28+
<meta name="robots" content="noindex" />
29+
<title>{`${t('401 Unauthorized')} - ${t('Docs')}`}</title>
30+
<meta
31+
property="og:title"
32+
content={`${t('401 Unauthorized')} - ${t('Docs')}`}
33+
key="title"
34+
/>
35+
</Head>
36+
<Box
37+
$align="center"
38+
$margin="auto"
39+
$gap="1rem"
40+
$padding={{ bottom: '2rem' }}
41+
>
42+
<Image
43+
className="c__image-system-filter"
44+
src={img401}
45+
alt={t('Image 401')}
46+
style={{
47+
maxWidth: '100%',
48+
height: 'auto',
49+
}}
50+
/>
51+
52+
<Box $align="center" $gap="0.8rem">
53+
<Text as="p" $textAlign="center" $maxWidth="350px" $theme="primary">
54+
{t('Log in to access the document.')}
55+
</Text>
56+
57+
<Button onClick={() => gotoLogin(false)} aria-label={t('Login')}>
58+
{t('Login')}
59+
</Button>
60+
</Box>
4961
</Box>
50-
</Box>
62+
</>
5163
);
5264
};
5365

0 commit comments

Comments
 (0)