-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use shared and content title and image for post types #2477
base: main
Are you sure you want to change the base?
Conversation
export const findPostImageFromContent = ({ | ||
post, | ||
}: { | ||
post: Pick<FreeformPost, 'content'>; | ||
}): string | undefined => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get first post image from content
if (depth > maxDepth) { | ||
return undefined; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is recursive (due to markdown structure being tree) I added depth so we don't go too deep and affect performance.
By default its 2 level, which should be more then enough for markdown content we can create in our editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool :)
@@ -88,8 +93,13 @@ const getPostsTemplateData = ({ | |||
const summary = post.summary || ''; | |||
|
|||
return { | |||
post_title: post.title, | |||
post_image: mapCloudinaryUrl(post.image || pickImageUrl(post)), | |||
post_title: post.title || post.sharedPostTitle, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I already added this, but maybe it was for another email.
Closes dailydotdev/daily#1600