@@ -5,6 +5,7 @@ import Category from 'components/outils/CategoryPage'
55import Outil from 'components/outils/Outil'
66import { simulators } from 'components/outils/simulators'
77import { getCategory } from 'utils/category'
8+ import { toolsJsonLd } from 'utils/jsonLd'
89import { metaDescriptions , metaTitles } from 'utils/meta'
910import { devTools , smallTools } from 'components/cards/tools'
1011import Suggestion from 'components/layout/Suggestion'
@@ -17,7 +18,7 @@ export async function generateStaticParams() {
1718 tool : tool . slug ,
1819 } ) ) ,
1920 ...categories . map ( ( category ) => ( { tool : category . slug } ) ) ,
20- ]
21+ ] . filter ( ( { tool } ) => tool !== 'caspratiques' )
2122}
2223
2324type Props = {
@@ -29,6 +30,10 @@ export async function generateMetadata(props: Props, parent: ResolvingMetadata):
2930 const searchParams = await props . searchParams
3031 const params = await props . params
3132 const tool = tools . find ( ( tool ) => tool . slug === params . tool )
33+ if ( params . tool === 'caspratiques' ) {
34+ return parent as Metadata
35+ }
36+
3237 if ( tool ) {
3338 return {
3439 title : `${ tool . title } | Impact CO₂` ,
@@ -60,9 +65,15 @@ const OutilPage = async (props: Props) => {
6065 const params = await props . params
6166 const tool = tools . find ( ( tool ) => tool . slug === params . tool )
6267
68+ if ( params . tool === 'caspratiques' ) {
69+ return notFound ( )
70+ }
71+
72+ const jsonLd = toolsJsonLd [ params . tool ]
6373 if ( tool ) {
6474 return (
6575 < >
76+ { jsonLd && < script type = 'application/ld+json' dangerouslySetInnerHTML = { { __html : JSON . stringify ( jsonLd ) } } /> }
6677 < Outil tool = { tool } />
6778 < Suggestion fromLabel = { tool . title } simulatorName = { `de l'outil ${ tool . title } ` } />
6879 </ >
@@ -72,6 +83,7 @@ const OutilPage = async (props: Props) => {
7283 if ( category ) {
7384 return (
7485 < >
86+ { jsonLd && < script type = 'application/ld+json' dangerouslySetInnerHTML = { { __html : JSON . stringify ( jsonLd ) } } /> }
7587 < Category
7688 category = { category }
7789 simulator = { simulators [ params . tool ] }
0 commit comments