Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions next-sitemap.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -12,11 +24,6 @@ export default {
additionalSitemaps: [
new URL("/wp-sitemap.xml", SITE_URL), // <==== Add here
],
policies: [
{
userAgent: "*",
allow: "/",
},
],
policies: [policy],
},
};
8 changes: 1 addition & 7 deletions scripts/smart-search.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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) {
Expand Down