diff --git a/frontend/src/constants/meta.ts b/frontend/src/constants/meta.ts index 4f66ce3b89b..d48e19fd72b 100644 --- a/frontend/src/constants/meta.ts +++ b/frontend/src/constants/meta.ts @@ -24,10 +24,10 @@ export const meta = [ name: "description", content: DESCRIPTION, }, - { hid: "og:title", name: "og:title", content: "Openverse" }, + { hid: "og:title", property: "og:title", content: "Openverse" }, { hid: "og:image", - name: "og:image", + property: "og:image", content: "/openverse-default.jpg", }, { diff --git a/frontend/src/utils/og.ts b/frontend/src/utils/og.ts index f3ef6c314ff..075610a80a3 100644 --- a/frontend/src/utils/og.ts +++ b/frontend/src/utils/og.ts @@ -1,5 +1,8 @@ import type { MetaInfo } from "vue-meta" -import type { MetaPropertyName } from "vue-meta/types/vue-meta" +import type { + MetaPropertyName, + MetaPropertyProperty, +} from "vue-meta/types/vue-meta" export const createDetailPageMeta = ({ title, @@ -18,18 +21,18 @@ export const createDetailPageMeta = ({ name: "robots", content: "noindex", }, - ] as MetaPropertyName[] + ] as (MetaPropertyName | MetaPropertyProperty)[] if (title) { meta.push({ hid: "og:title", - name: "og:title", + property: "og:title", content: title, }) } if (thumbnail && !isSensitive) { meta.push({ hid: "og:image", - name: "og:image", + property: "og:image", content: thumbnail, }) } diff --git a/frontend/test/playwright/e2e/seo.spec.ts b/frontend/test/playwright/e2e/seo.spec.ts index 39385e402cd..6470bbe7900 100644 --- a/frontend/test/playwright/e2e/seo.spec.ts +++ b/frontend/test/playwright/e2e/seo.spec.ts @@ -70,13 +70,13 @@ test.describe("Page metadata", () => { const metaRobots = page.locator('meta[name="robots"]') await expect(metaRobots).toHaveAttribute("content", openversePage.robots) - const metaOgImage = page.locator('meta[name="og:image"]') + const metaOgImage = page.locator('meta[property="og:image"]') await expect(metaOgImage).toHaveAttribute( "content", openversePage.ogImage ) - const metaOgTitle = page.locator('meta[name="og:title"]') + const metaOgTitle = page.locator('meta[property="og:title"]') await expect(metaOgTitle).toHaveAttribute( "content", openversePage.ogTitle