aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/index.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-16 12:46:38 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-16 12:46:38 +0200
commit2155550fa36a3bc3c8f66e0926530123b4018cd4 (patch)
tree1b7472d7ceeb9c95b2c6de6440b48b94405e155e /src/pages/index.tsx
parent8a55aa83bd4b64d1d989cb49b7d9c3fdc1cc6ea5 (diff)
refactor: use custom hook for breadcrumb items and schema
Diffstat (limited to 'src/pages/index.tsx')
-rw-r--r--src/pages/index.tsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index bc9b572..1143a33 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -19,6 +19,7 @@ import { getArticlesCard } from '@services/graphql/articles';
import styles from '@styles/pages/home.module.scss';
import { ArticleCard } from '@ts/types/app';
import { loadTranslation, type Messages } from '@utils/helpers/i18n';
+import useBreadcrumb from '@utils/hooks/use-breadcrumb';
import useSettings from '@utils/hooks/use-settings';
import { NestedMDXComponents } from 'mdx/types';
import { GetStaticProps, NextPage } from 'next';
@@ -38,6 +39,10 @@ type HomeProps = {
*/
const HomePage: NextPage<HomeProps> = ({ recentPosts }) => {
const intl = useIntl();
+ const { schema: breadcrumbSchema } = useBreadcrumb({
+ title: '',
+ url: `/`,
+ });
/**
* Retrieve a list of coding links.
@@ -322,7 +327,7 @@ const HomePage: NextPage<HomeProps> = ({ recentPosts }) => {
};
return (
- <Layout isHome={true}>
+ <Layout breadcrumbSchema={breadcrumbSchema} isHome={true}>
<Head>
<title>{pageTitle}</title>
<meta name="description" content={pageDescription} />
@@ -340,7 +345,7 @@ const HomePage: NextPage<HomeProps> = ({ recentPosts }) => {
);
};
-export const getStaticProps: GetStaticProps = async ({ locale }) => {
+export const getStaticProps: GetStaticProps<HomeProps> = async ({ locale }) => {
const translation = await loadTranslation(locale);
const recentPosts = await getArticlesCard({ first: 3 });