0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Fixed WordPress article feature image not showing (#21779)

ref https://linear.app/ghost/issue/AP-619/feature-images-from-wordpress-are-[object-object]

- WordPress puts the feature image into an `image` object, rather than putting the URL directly into an `image` string. We now properly render this.
This commit is contained in:
Djordje Vlaisavljevic 2024-12-02 15:50:27 +00:00 committed by GitHub
parent 5c3e26351a
commit 550a52598c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@tryghost/admin-x-activitypub",
"version": "0.3.32",
"version": "0.3.33",
"license": "MIT",
"repository": {
"type": "git",

View file

@ -354,7 +354,7 @@ const ArticleModal: React.FC<ArticleModalProps> = ({
excerpt={object?.preview?.content}
heading={object.name}
html={object.content}
image={object?.image}
image={typeof object.image === 'string' ? object.image : object.image?.url}
/>
<div className='ml-[-7px]'>
<FeedItemStats

View file

@ -85,7 +85,7 @@ export function renderFeedAttachment(object: ObjectProperties, layout: string) {
</div>;
default:
if (object.image) {
return <img alt='attachment' className='my-3 max-h-[280px] w-full rounded-md object-cover outline outline-1 -outline-offset-1 outline-black/[0.05]' src={object.image} />;
return <img alt='attachment' className='my-3 max-h-[280px] w-full rounded-md object-cover outline outline-1 -outline-offset-1 outline-black/[0.05]' src={typeof object.image === 'string' ? object.image : object.image?.url} />;
}
return null;
}
@ -137,7 +137,7 @@ function renderInboxAttachment(object: ObjectProperties) {
);
default:
if (object.image) {
return <img className={imageAttachmentStyles} src={object.image} />;
return <img className={imageAttachmentStyles} src={typeof object.image === 'string' ? object.image : object.image?.url} />;
}
return null;
}

View file

@ -14,7 +14,11 @@ export type ObjectProperties = {
content: string;
url?: string | undefined;
attributedTo?: object | string | object[] | undefined;
image?: string;
image?: string | {
url: string;
mediaType?: string;
type?: string;
};
published?: string;
preview?: {type: string, content: string};
// eslint-disable-next-line @typescript-eslint/no-explicit-any