Skip to content

Commit 4fc49d5

Browse files
AppryllAntoLC
authored andcommitted
♿️(frontend) Set page titles for 403 and 404 errors
Set the page titles for the 403 and 404 error pages to improve user experience and accessibility.
1 parent 0fd16b4 commit 4fc49d5

File tree

2 files changed

+82
-56
lines changed

2 files changed

+82
-56
lines changed

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

Lines changed: 40 additions & 27 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 { ReactElement } from 'react';
45
import { useTranslation } from 'react-i18next';
@@ -17,34 +18,46 @@ const Page: NextPageWithLayout = () => {
1718
const { t } = useTranslation();
1819

1920
return (
20-
<Box
21-
$align="center"
22-
$margin="auto"
23-
$gap="1rem"
24-
$padding={{ bottom: '2rem' }}
25-
>
26-
<Image
27-
className="c__image-system-filter"
28-
src={img403}
29-
alt={t('Image 403')}
30-
style={{
31-
maxWidth: '100%',
32-
height: 'auto',
33-
}}
34-
/>
35-
36-
<Box $align="center" $gap="0.8rem">
37-
<Text as="p" $textAlign="center" $maxWidth="350px" $theme="primary">
38-
{t('You do not have permission to view this document.')}
39-
</Text>
40-
41-
<StyledLink href="/">
42-
<StyledButton icon={<Icon iconName="house" $color="white" />}>
43-
{t('Home')}
44-
</StyledButton>
45-
</StyledLink>
21+
<>
22+
<Head>
23+
<title>
24+
{t('Access Denied - Error 403')} - {t('Docs')}
25+
</title>
26+
<meta
27+
property="og:title"
28+
content={`${t('Access Denied - Error 403')} - ${t('Docs')}`}
29+
key="title"
30+
/>
31+
</Head>
32+
<Box
33+
$align="center"
34+
$margin="auto"
35+
$gap="1rem"
36+
$padding={{ bottom: '2rem' }}
37+
>
38+
<Image
39+
className="c__image-system-filter"
40+
src={img403}
41+
alt={t('Image 403')}
42+
style={{
43+
maxWidth: '100%',
44+
height: 'auto',
45+
}}
46+
/>
47+
48+
<Box $align="center" $gap="0.8rem">
49+
<Text as="p" $textAlign="center" $maxWidth="350px" $theme="primary">
50+
{t('You do not have permission to view this document.')}
51+
</Text>
52+
53+
<StyledLink href="/">
54+
<StyledButton icon={<Icon iconName="house" $color="white" />}>
55+
{t('Home')}
56+
</StyledButton>
57+
</StyledLink>
58+
</Box>
4659
</Box>
47-
</Box>
60+
</>
4861
);
4962
};
5063

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

Lines changed: 42 additions & 29 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 { ReactElement } from 'react';
45
import { useTranslation } from 'react-i18next';
@@ -17,36 +18,48 @@ const Page: NextPageWithLayout = () => {
1718
const { t } = useTranslation();
1819

1920
return (
20-
<Box
21-
$align="center"
22-
$margin="auto"
23-
$gap="1rem"
24-
$padding={{ bottom: '2rem' }}
25-
>
26-
<Image
27-
className="c__image-system-filter"
28-
src={img403}
29-
alt={t('Image 403')}
30-
style={{
31-
maxWidth: '100%',
32-
height: 'auto',
33-
}}
34-
/>
35-
36-
<Box $align="center" $gap="0.8rem">
37-
<Text as="p" $textAlign="center" $maxWidth="350px" $theme="primary">
38-
{t(
39-
'It seems that the page you are looking for does not exist or cannot be displayed correctly.',
40-
)}
41-
</Text>
42-
43-
<StyledLink href="/">
44-
<StyledButton icon={<Icon iconName="house" $color="white" />}>
45-
{t('Home')}
46-
</StyledButton>
47-
</StyledLink>
21+
<>
22+
<Head>
23+
<title>
24+
{t('Page Not Found - Error 404')} - {t('Docs')}
25+
</title>
26+
<meta
27+
property="og:title"
28+
content={`${t('Page Not Found - Error 404')} - ${t('Docs')}`}
29+
key="title"
30+
/>
31+
</Head>
32+
<Box
33+
$align="center"
34+
$margin="auto"
35+
$gap="1rem"
36+
$padding={{ bottom: '2rem' }}
37+
>
38+
<Image
39+
className="c__image-system-filter"
40+
src={img403}
41+
alt={t('Image 403')}
42+
style={{
43+
maxWidth: '100%',
44+
height: 'auto',
45+
}}
46+
/>
47+
48+
<Box $align="center" $gap="0.8rem">
49+
<Text as="p" $textAlign="center" $maxWidth="350px" $theme="primary">
50+
{t(
51+
'It seems that the page you are looking for does not exist or cannot be displayed correctly.',
52+
)}
53+
</Text>
54+
55+
<StyledLink href="/">
56+
<StyledButton icon={<Icon iconName="house" $color="white" />}>
57+
{t('Home')}
58+
</StyledButton>
59+
</StyledLink>
60+
</Box>
4861
</Box>
49-
</Box>
62+
</>
5063
);
5164
};
5265

0 commit comments

Comments
 (0)