From 0f38aee374029213a47ef7c29bd164093fe63c85 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 15 Nov 2023 12:24:42 +0100 Subject: refactor(hooks): remove useSettings hook It does not make sense to re-export an existing object through a hook. On some pages both the hook and the object was imported... It is better to use the CONFIG (previously settings) object directly and by doing it we avoid potential errors because of conditional hooks. --- src/pages/index.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/pages/index.tsx') diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 7ff1379..0306736 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -30,10 +30,11 @@ import HomePageContent from '../content/pages/homepage.mdx'; import { getArticlesCard } from '../services/graphql'; import styles from '../styles/pages/home.module.scss'; import type { ArticleCard, NextPageWithLayout } from '../types'; +import { CONFIG } from '../utils/config'; import { PERSONAL_LINKS, ROUTES } from '../utils/constants'; import { getSchemaJson, getWebPageSchema } from '../utils/helpers'; import { loadTranslation, type Messages } from '../utils/helpers/server'; -import { useBreadcrumb, useSettings } from '../utils/hooks'; +import { useBreadcrumb } from '../utils/hooks'; /** * Column component. @@ -388,15 +389,13 @@ const HomePage: NextPageWithLayout = ({ recentPosts }) => { ShaarliLink, }; - const { website } = useSettings(); - const pageTitle = intl.formatMessage( { defaultMessage: '{websiteName} | Front-end developer: WordPress/React', description: 'HomePage: SEO - Page title', id: 'PXp2hv', }, - { websiteName: website.name } + { websiteName: CONFIG.name } ); const pageDescription = intl.formatMessage( { @@ -405,11 +404,11 @@ const HomePage: NextPageWithLayout = ({ recentPosts }) => { description: 'HomePage: SEO - Meta description', id: 'tMuNTy', }, - { websiteName: website.name } + { websiteName: CONFIG.name } ); const webpageSchema = getWebPageSchema({ description: pageDescription, - locale: website.locales.default, + locale: CONFIG.locales.defaultLocale, slug: '', title: pageTitle, }); @@ -421,7 +420,7 @@ const HomePage: NextPageWithLayout = ({ recentPosts }) => { {pageTitle} {/*eslint-disable-next-line react/jsx-no-literals -- Name allowed */} - + -- cgit v1.2.3