Skip to content

Commit 2c5ff0d

Browse files
committed
fix(seo): omit unsupported author avatar dimensions
1 parent 10fa7c4 commit 2c5ff0d

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

apps/sim/lib/content/seo.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { describe, expect, it, vi } from 'vitest'
77
import type { ContentMeta } from '@/lib/content/schema'
88
import {
99
buildArticleJsonLd,
10+
buildAuthorMetadata,
1011
buildCollectionPageJsonLd,
1112
buildIndexMetadata,
1213
buildPostMetadata,
@@ -113,4 +114,16 @@ describe('content social images', () => {
113114
format: 'png',
114115
})
115116
})
117+
118+
it.each([teamAuthor.avatarUrl, 'https://example.com/avatar.jpg'])(
119+
'keeps the author avatar without inventing dimensions for %s',
120+
(avatarUrl) => {
121+
const metadata = buildAuthorMetadata(SECTIONS[0], teamAuthor.id, {
122+
...teamAuthor,
123+
avatarUrl,
124+
})
125+
126+
expect(metadata.openGraph?.images).toEqual([{ url: avatarUrl, alt: teamAuthor.name }])
127+
}
128+
)
116129
})

apps/sim/lib/content/seo.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,7 @@ export function buildAuthorMetadata(
302302
url: canonical,
303303
siteName: 'Sim',
304304
type: 'profile',
305-
...(author?.avatarUrl
306-
? { images: [{ url: author.avatarUrl, width: 400, height: 400, alt: name }] }
307-
: {}),
305+
...(author?.avatarUrl ? { images: [{ url: author.avatarUrl, alt: name }] } : {}),
308306
},
309307
twitter: {
310308
card: 'summary',

0 commit comments

Comments
 (0)