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:
parent
5c3e26351a
commit
550a52598c
4 changed files with 9 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@tryghost/admin-x-activitypub",
|
||||
"version": "0.3.32",
|
||||
"version": "0.3.33",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue