diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-15 12:24:42 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-15 17:26:16 +0100 |
| commit | 0f38aee374029213a47ef7c29bd164093fe63c85 (patch) | |
| tree | 290cb6471fdfe81e4c42f4da4729247536b04ee7 /src/pages/index.tsx | |
| parent | be4d907efb4e2fa658baa7c9b276ed282eb920db (diff) | |
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.
Diffstat (limited to 'src/pages/index.tsx')
| -rw-r--r-- | src/pages/index.tsx | 13 |
1 files changed, 6 insertions, 7 deletions
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<HomeProps> = ({ 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<HomeProps> = ({ 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<HomeProps> = ({ recentPosts }) => { <title>{pageTitle}</title> {/*eslint-disable-next-line react/jsx-no-literals -- Name allowed */} <meta name="description" content={pageDescription} /> - <meta property="og:url" content={website.url} /> + <meta property="og:url" content={CONFIG.url} /> <meta property="og:title" content={pageTitle} /> <meta property="og:description" content={pageDescription} /> </Head> |
