From b8b84bef13b97c04ae874b7f77cfae6fa97d9e68 Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Mon, 29 Jul 2024 18:17:41 +0300 Subject: [PATCH] Allow robots on single result pages Signed-off-by: Olga Bulat --- frontend/src/utils/og.ts | 8 +++++++- frontend/test/playwright/e2e/seo.spec.ts | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/frontend/src/utils/og.ts b/frontend/src/utils/og.ts index f7fe71a67fb..ea5627972db 100644 --- a/frontend/src/utils/og.ts +++ b/frontend/src/utils/og.ts @@ -16,7 +16,13 @@ export const createDetailPageMeta = ({ isSensitive: boolean }) => { const head: { meta: Meta } = { meta: [] } - const meta: Meta = [] + const meta: Meta = [ + { + key: "robots", + name: "robots", + content: "all", + }, + ] if (title) { meta.push({ key: "og:title", diff --git a/frontend/test/playwright/e2e/seo.spec.ts b/frontend/test/playwright/e2e/seo.spec.ts index c28f49ee0de..4d7490c0055 100644 --- a/frontend/test/playwright/e2e/seo.spec.ts +++ b/frontend/test/playwright/e2e/seo.spec.ts @@ -5,7 +5,7 @@ import { preparePageForTests } from "~~/test/playwright/utils/navigation" test.describe.configure({ mode: "parallel" }) const DESCRIPTION = "Search over 800 million free and openly licensed images, photos, audio, and other media types for reuse and remixing." -const ROBOTS = "noindex, nofollow" +const NO_INDEX = "noindex, nofollow" const DEFAULT_IMAGE = "/openverse-default.jpg" const pages = { @@ -14,28 +14,28 @@ const pages = { title: "Openly Licensed Images, Audio and More | Openverse", ogImage: DEFAULT_IMAGE, ogTitle: "Openverse", - robots: ROBOTS, + robots: NO_INDEX, }, allSearch: { url: "/search/?q=birds", title: "birds | Openverse", ogImage: DEFAULT_IMAGE, ogTitle: "Openverse", - robots: ROBOTS, + robots: NO_INDEX, }, imageSearch: { url: "/search/image?q=birds", title: "birds | Openverse", ogImage: DEFAULT_IMAGE, ogTitle: "Openverse", - robots: ROBOTS, + robots: NO_INDEX, }, audioSearch: { url: "/search/audio?q=birds", title: "birds | Openverse", ogImage: DEFAULT_IMAGE, ogTitle: "Openverse", - robots: ROBOTS, + robots: NO_INDEX, }, imageDetail: { url: "/image/da5cb478-c093-4d62-b721-cda18797e3fb", @@ -44,7 +44,7 @@ const pages = { "/v1/images/da5cb478-c093-4d62-b721-cda18797e3fb/thumb/" ), ogTitle: "bird", - robots: ROBOTS, + robots: "all", }, audioDetail: { url: "/audio/7e063ee6-343f-48e4-a4a5-f436393730f6", @@ -53,35 +53,35 @@ const pages = { "/v1/audio/7e063ee6-343f-48e4-a4a5-f436393730f6/thumb/" ), ogTitle: "I Love My Dog You Love your Cat", - robots: ROBOTS, + robots: "all", }, about: { url: "/about", title: "About Openverse | Openverse", ogImage: DEFAULT_IMAGE, ogTitle: "Openverse", - robots: ROBOTS, + robots: NO_INDEX, }, tag: { url: "/image/collection?tag=cat", title: "cat images | Openverse", ogImage: DEFAULT_IMAGE, ogTitle: "cat images | Openverse", - robots: ROBOTS, + robots: NO_INDEX, }, source: { url: "/image/collection?source=flickr", title: "Flickr images | Openverse", ogImage: DEFAULT_IMAGE, ogTitle: "Flickr images | Openverse", - robots: ROBOTS, + robots: NO_INDEX, }, creator: { url: "/image/collection?source=flickr&creator=strogoscope", title: "strogoscope | Openverse", ogImage: DEFAULT_IMAGE, ogTitle: "strogoscope | Openverse", - robots: ROBOTS, + robots: NO_INDEX, }, } test.describe("page metadata", () => {