fix: 🐛 need new fallback for ogImage (#25)

Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
This commit is contained in:
create-issue-branch[bot] 2024-03-16 11:05:57 -07:00 committed by GitHub
parent b375a29495
commit 6464de28f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@matthiesenxyz/astro-hashnode": patch
---
[fix] add extra fallback option for ogImage

View File

@ -129,6 +129,9 @@ export const getPublication = async () => {
displayTitle displayTitle
descriptionSEO descriptionSEO
favicon favicon
author {
profilePicture
}
preferences { preferences {
logo logo
disableFooterBranding disableFooterBranding

View File

@ -60,6 +60,9 @@ export const PublicationDataSchema = z.object({
displayTitle: z.string(), displayTitle: z.string(),
descriptionSEO: z.string(), descriptionSEO: z.string(),
favicon: z.string(), favicon: z.string(),
author: z.object({
profilePicture: z.string(),
}),
preferences: z.object({ preferences: z.object({
logo: z.string(), logo: z.string(),
disableFooterBranding: z.boolean(), disableFooterBranding: z.boolean(),

View File

@ -41,7 +41,7 @@ const { pageTitle, hideFooter, hideHeader, ogImage } = Astro.props as AstroHashn
basic: { basic: {
title: pageTitle ? pageTitle + " | " + pubHeader : pubHeader, title: pageTitle ? pageTitle + " | " + pubHeader : pubHeader,
type: 'text', type: 'text',
image: ogImage || pubData.favicon, image: ogImage || pubData.favicon || pubData.author.profilePicture,
}, },
optional: { optional: {
description: pubData.descriptionSEO, description: pubData.descriptionSEO,