diff --git a/next-sitemap.config.mjs b/next-sitemap.config.mjs index 96e80146..78e158c6 100644 --- a/next-sitemap.config.mjs +++ b/next-sitemap.config.mjs @@ -2,6 +2,18 @@ import { env } from "node:process"; import { URL } from "node:url"; const SITE_URL = env.NEXT_PUBLIC_SITE_URL; +const HP_ENV_NAME = env.HEADLESS_METADATA_ENV_NAME; + +const policy = + HP_ENV_NAME === "faust-prod" + ? { + userAgent: "*", + allow: "/", + } + : { + userAgent: "*", + disallow: "/", + }; export default { siteUrl: SITE_URL, @@ -12,11 +24,6 @@ export default { additionalSitemaps: [ new URL("/wp-sitemap.xml", SITE_URL), // <==== Add here ], - policies: [ - { - userAgent: "*", - allow: "/", - }, - ], + policies: [policy], }, }; diff --git a/scripts/smart-search.mjs b/scripts/smart-search.mjs index 6df5e370..7f2ce2e2 100644 --- a/scripts/smart-search.mjs +++ b/scripts/smart-search.mjs @@ -10,11 +10,10 @@ import { const { NEXT_PUBLIC_SEARCH_ENDPOINT: endpoint, NEXT_SEARCH_ACCESS_TOKEN: accessToken, - HEADLESS_METADATA_ENV_BRANCH: branchName, } = env; async function main() { - if (branchName === "main" && (!endpoint || !accessToken)) { + if (!endpoint || !accessToken) { console.error("Search endpoint and accessToken are required for indexing."); exit(1); } @@ -24,11 +23,6 @@ async function main() { console.log("Docs Pages collected for indexing:", pages.length); - if (branchName !== "main") { - console.log("Skipping indexing in non-production mode."); - exit(0); - } - await deleteOldDocs(); await sendPagesToEndpoint(pages); } catch (error) {