Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Commit

Permalink
fix: 🐛 need new fallback for ogImage (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com>
Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
  • Loading branch information
create-issue-branch[bot] and Adammatthiesen authored Mar 16, 2024
1 parent b375a29 commit 6464de2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/spotty-lizards-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@matthiesenxyz/astro-hashnode": patch
---

[fix] add extra fallback option for ogImage
3 changes: 3 additions & 0 deletions package/src/hn-gql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ export const getPublication = async () => {
displayTitle
descriptionSEO
favicon
author {
profilePicture
}
preferences {
logo
disableFooterBranding
Expand Down
3 changes: 3 additions & 0 deletions package/src/hn-gql/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ export const PublicationDataSchema = z.object({
displayTitle: z.string(),
descriptionSEO: z.string(),
favicon: z.string(),
author: z.object({
profilePicture: z.string(),
}),
preferences: z.object({
logo: z.string(),
disableFooterBranding: z.boolean(),
Expand Down
2 changes: 1 addition & 1 deletion package/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const { pageTitle, hideFooter, hideHeader, ogImage } = Astro.props as AstroHashn
basic: {
title: pageTitle ? pageTitle + " | " + pubHeader : pubHeader,
type: 'text',
image: ogImage || pubData.favicon,
image: ogImage || pubData.favicon || pubData.author.profilePicture,
},
optional: {
description: pubData.descriptionSEO,
Expand Down

0 comments on commit 6464de2

Please sign in to comment.