diff --git a/src/app/[locale]/blog/[slug]/page.tsx b/src/app/[locale]/blog/[slug]/page.tsx index f344216..ca1938a 100644 --- a/src/app/[locale]/blog/[slug]/page.tsx +++ b/src/app/[locale]/blog/[slug]/page.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import type { Metadata } from 'next'; +import type {Metadata, ResolvingMetadata} from 'next'; import { draftMode } from 'next/headers' import { notFound } from 'next/navigation'; import {fetchBlogPost, fetchBlogPosts, Widget} from "../../../../lib/contentful/blogPosts"; @@ -23,7 +23,7 @@ export async function generateMetadata({ params }: BlogPostPageProps, parent: Re return { title: blogPost.title, - // description: blogPost.metaDescription + description: blogPost.metaDescription } } diff --git a/src/lib/contentful/blogPosts.ts b/src/lib/contentful/blogPosts.ts index 92b75fd..8c670a8 100644 --- a/src/lib/contentful/blogPosts.ts +++ b/src/lib/contentful/blogPosts.ts @@ -77,7 +77,7 @@ export async function fetchBlogPosts({ preview, category, page, sticky }: FetchB const contentful = contentfulClient({ preview }) const query = { content_type: 'blogPost', - select: ['fields.title', 'fields.excerpt', 'fields.author', 'fields.listImage', 'fields.author', 'fields.category', 'sys.createdAt', 'fields.slug'], + select: ['fields.title', 'fields.excerpt', 'fields.author', 'fields.listImage', 'fields.author', 'fields.category', 'sys.createdAt', 'fields.slug', 'fields.metaDescription'], order: ['sys.createdAt'], } if (category){ diff --git a/src/types/blogPost.ts b/src/types/blogPost.ts index c4776c4..5304b7d 100644 --- a/src/types/blogPost.ts +++ b/src/types/blogPost.ts @@ -9,6 +9,7 @@ export interface BlogPostFields { title?: EntryFieldTypes.Symbol slug: EntryFieldTypes.Symbol excerpt: EntryFieldTypes.Symbol + metaDescription: EntryFieldTypes.Symbol listImage?: EntryFieldTypes.AssetLink author?: AuthorSkeleton category: BlogPostCategorySkeleton @@ -28,6 +29,7 @@ export interface BlogPost { author: Author | null category: string createdAt: string + metaDescription: string body: Array }