diff --git a/src/components/post/post.tsx b/src/components/post/post.tsx index efdd9833..b693c6b0 100644 --- a/src/components/post/post.tsx +++ b/src/components/post/post.tsx @@ -160,8 +160,10 @@ const Post = ({ index, post = {} }: PostProps) => { const [upvoted, upvote] = useUpvote(post); const [downvoted, downvote] = useDownvote(post); const postScore = getPostScore(upvoteCount, downvoteCount, state); - const postTitle = (title?.length > 300 ? title?.slice(0, 300) + '...' : title) || (content?.length > 300 ? content?.slice(0, 300) + '...' : content); - const highlightedTitle = searchQuery ? highlightMatchedText(postTitle || '', searchQuery) : postTitle; + const postTitle = + (title?.length > 300 ? title?.slice(0, 300) + '...' : title) || + (content?.length > 300 ? content?.slice(0, 300) + '...' : content)?.replace(' ', ' ')?.replace('>', '')?.replace('<', '')?.trim(); + const displayedTitle = searchQuery ? highlightMatchedText(postTitle || '', searchQuery) : postTitle; const hasThumbnail = getHasThumbnail(commentMediaInfo, link); const hostname = getHostname(link); @@ -236,11 +238,11 @@ const Post = ({ index, post = {} }: PostProps) => {
{isInPostPageView && link ? ( - {highlightedTitle ?? '-'} + {displayedTitle ?? '-'} ) : ( - {highlightedTitle ?? '-'} + {displayedTitle ?? '-'} )} {flair && (