Skip to content

Commit

Permalink
Feat: title 보다 og:title 태그가 우선 반영되도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
imjihun committed Apr 28, 2022
1 parent f68abd9 commit 9737ed3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ export const getPreviewData = async (text: string, requestTimeout = 5000) => {
title: ogTitle ? getHtmlEntitiesDecodedText(ogTitle) : acc.title,
}
},
{ title: previewData.title }
{}
)

previewData.description = metaPreviewData.description
previewData.image = await getPreviewDataImage(metaPreviewData.imageUrl)
previewData.title = metaPreviewData.title
previewData.title = metaPreviewData.title || previewData.title

if (!previewData.image) {
let imageMatches: RegExpMatchArray | null
Expand Down Expand Up @@ -202,17 +202,17 @@ export const getPreviewDataImage = async (url?: string) => {
const image: PreviewDataImage = { height, url, width }
return image
}
} catch {}
} catch { }
}

export const oneOf =
<T extends (...args: A) => any, U, A extends any[]>(
truthy: T | undefined,
falsy: U
) =>
(...args: Parameters<T>): ReturnType<T> | U => {
return truthy ? truthy(...args) : falsy
}
(...args: Parameters<T>): ReturnType<T> | U => {
return truthy ? truthy(...args) : falsy
}

export const REGEX_EMAIL = /([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/g
export const REGEX_IMAGE_CONTENT_TYPE = /image\/*/g
Expand Down

0 comments on commit 9737ed3

Please sign in to comment.