Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
type Meta = {
key: string
property: string
content: string
}[]
export const createDetailPageMeta = ({
title,
thumbnail,
isSensitive,
}: {
/** Media title or localized sensitive or generic media title */
title?: string
thumbnail?: string
isSensitive: boolean
}) => {
const head: { meta: Meta } = { meta: [] }
const meta: Meta = []
if (title) {
meta.push({
key: "og:title",
property: "og:title",
content: title,
})
}
if (thumbnail && !isSensitive) {
meta.push({
key: "og:image",
property: "og:image",
content: thumbnail,
})
}
head.meta = meta
return head
}