Skip to content

Commit 421aec6

Browse files
fix metadata
1 parent 8e7dbf0 commit 421aec6

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

app/blog/[...slug]/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@ export async function generateMetadata(props: {
3939
const modifiedAt = new Date(post.lastmod || post.date).toISOString()
4040
const authors = authorDetails.map((author) => author.name)
4141
let imageList = [siteMetadata.socialBanner]
42-
if (post.images) {
43-
imageList = typeof post.images === 'string' ? [post.images] : post.images
42+
if (post.images.length > 0) {
43+
imageList = post.images
4444
}
4545
const ogImages = imageList.map((img) => {
4646
return {
4747
url: img.includes('http') ? img : siteMetadata.siteUrl + img,
4848
}
4949
})
50-
5150
return {
5251
title: {
5352
absolute: post.title,

contentlayer.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ const computedFields: ComputedFields = {
6161
resolve: (doc) => doc._raw.sourceFilePath,
6262
},
6363
images: {
64-
type: 'json',
65-
resolve: (doc) => {
64+
type: 'list',
65+
resolve: (doc): string[] => {
6666
const images = doc.images || []
6767
return doc.cover ? [doc.cover, ...images] : images
6868
},
@@ -139,7 +139,7 @@ export const Blog = defineDocumentType(() => ({
139139
lastmod: { type: 'string' },
140140
draft: { type: 'boolean' },
141141
summary: { type: 'string' },
142-
images: { type: 'json' },
142+
images: { type: 'list', of: { type: 'string' }, default: [] },
143143
cover: { type: 'string' },
144144
authors: { type: 'list', of: { type: 'string' } },
145145
layout: { type: 'string' },

data/siteMetadata.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const siteMetadata = {
1414
siteUrl: process.env.NEXT_PUBLIC_APP_URL,
1515
siteRepo: 'https://github.com/franciscomoretti/site',
1616
siteLogo: `${process.env.BASE_PATH || ''}/static/logo.svg`,
17-
keywords: ['Next.js', 'React', 'Tailwind CSS', 'Server Components', 'Radix UI'],
18-
socialBanner: `${process.env.BASE_PATH || ''}/static/images/app/opengraph-image.jpg`,
17+
keywords: ['Next.js', 'React', 'Tailwind CSS', 'TypeScript', 'JavaScript', 'AI'],
18+
socialBanner: `${process.env.BASE_PATH || ''}/static/images/opengraph-image.jpg`,
1919
// mastodon: 'https://mastodon.social/@mastodonuser',
2020
email: 'franciscoemoretti@gmail.com',
2121
github: 'https://github.com/franciscomoretti',

0 commit comments

Comments
 (0)