Skip to content

Commit d77cb7a

Browse files
committed
chore: remove double h1 in notion
1 parent b139cfc commit d77cb7a

8 files changed

Lines changed: 18 additions & 9 deletions

File tree

app/(public)/contenu/comment-sensibiliser-vos-visiteurs-empreinte-carbone/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const NewSite = async () => {
2121

2222
return (
2323
<>
24-
<Notion title={title} recordMap={recordMap} />
24+
<Notion title={title} recordMap={recordMap} noTitle />
2525
<Suggestion fromLabel={title} simulatorName='des ressources de sensibilisation' />
2626
</>
2727
)

app/(public)/contenu/etiquette-carbone/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const NewSite = async () => {
2020

2121
return (
2222
<>
23-
<Notion title={title} recordMap={recordMap} />
23+
<Notion title={title} recordMap={recordMap} noTitle />
2424
<Suggestion fromLabel={title} simulatorName="de l'étiquette carbone" />
2525
</>
2626
)

app/(public)/contenu/impact-carbone-hiver-station-ski/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const SkiPage = async () => {
2121

2222
return (
2323
<>
24-
<Notion title={title} recordMap={recordMap} />
24+
<Notion title={title} recordMap={recordMap} noTitle />
2525
<Suggestion fromLabel={title} simulatorName='de ce contenu' />
2626
</>
2727
)

app/(public)/contenu/nouveau-site/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const NewSite = async () => {
2020

2121
return (
2222
<>
23-
<Notion title={title} recordMap={recordMap} />
23+
<Notion title={title} recordMap={recordMap} noTitle />
2424
<Suggestion fromLabel={title} simulatorName='du nouveau site' />
2525
</>
2626
)

app/(public)/contenu/quiz-carbone/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const QuizCarbone = async () => {
2121

2222
return (
2323
<>
24-
<Notion title={title} recordMap={recordMap} />
24+
<Notion title={title} recordMap={recordMap} noTitle />
2525
<Suggestion fromLabel={title} simulatorName='du quiz carbone' />
2626
</>
2727
)

app/(public)/contenu/semaine-mobilite-simulateur-transport-ademe/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const NewSite = async () => {
2121

2222
return (
2323
<>
24-
<Notion title={title} recordMap={recordMap} />
24+
<Notion title={title} recordMap={recordMap} noTitle />
2525
<Suggestion fromLabel={title} simulatorName='de la semaine de la mobilité' />
2626
</>
2727
)

src/components/Notion/Notion.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@ const Notion = ({
2222
description,
2323
recordMap,
2424
previous,
25+
noTitle,
2526
}: {
2627
title: string
2728
description?: string
2829
recordMap: ExtendedRecordMap | undefined
2930
previous?: { link: string; label: string }
31+
noTitle?: boolean
3032
}) => {
3133
const ref = useRef<HTMLDivElement>(null)
3234
useEffect(() => {
3335
if (ref.current) {
34-
improveAccessibility(ref.current)
36+
improveAccessibility(ref.current, noTitle)
3537
}
36-
}, [ref])
38+
}, [ref, noTitle])
3739

3840
return (
3941
<>

src/components/Notion/utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const getNotionContentProps = unstable_cache(
1717
{ revalidate: getRevalidate(process.env.NOTION_TABLE_REVALIDATE) }
1818
)
1919

20-
export const improveAccessibility = (ref: HTMLDivElement) => {
20+
export const improveAccessibility = (ref: HTMLDivElement, noTitle?: boolean) => {
2121
const elements = ref.getElementsByTagName('svg')
2222
for (const element of elements) {
2323
element.setAttribute('alt', '')
@@ -54,4 +54,11 @@ export const improveAccessibility = (ref: HTMLDivElement) => {
5454
for (const fastLink of fastLinks) {
5555
fastLink.remove()
5656
}
57+
58+
if (noTitle) {
59+
const headers = ref.getElementsByTagName('h1')
60+
for (const header of headers) {
61+
header.remove()
62+
}
63+
}
5764
}

0 commit comments

Comments
 (0)