diff --git a/cypress/integration/sitemap-vrt/constants.ts b/cypress/integration/sitemap-vrt/constants.ts index 8e2a1b4188..da5a760981 100644 --- a/cypress/integration/sitemap-vrt/constants.ts +++ b/cypress/integration/sitemap-vrt/constants.ts @@ -340,7 +340,7 @@ export const SITEMAP = [ "/tokens/", ]; -const SITEMAP_CHUNKS: string[][] = []; +const SITEMAP_CHUNKS = []; const CHUNK_SIZE = 25; for (let i = 0, len = SITEMAP.length; i < len; i += CHUNK_SIZE) { diff --git a/packages/paste-website/src/pages/sitemap.xml.tsx b/packages/paste-website/src/pages/sitemap.xml.tsx index b858aebcdc..8b0318ddb6 100644 --- a/packages/paste-website/src/pages/sitemap.xml.tsx +++ b/packages/paste-website/src/pages/sitemap.xml.tsx @@ -1,46 +1,25 @@ -import { globby } from "globby-esm"; import type { GetServerSideProps } from "next"; -import { unstable_noStore as noStore } from "next/cache"; + +import { SITEMAP } from "../../../../cypress/integration/sitemap-vrt/constants"; // Import the SITEMAP used for cypress const Sitemap = (): React.ReactElement | null => { return null; }; export const getServerSideProps: GetServerSideProps = async ({ res }) => { - noStore(); const BASE_URL = "https://paste.twilio.design"; - // Get a list of all pages currently in the site, must be mdx and not tsx which they all currently are - const uncompiledPaths = await globby(["**/pages/**/*.mdx", "!**/api/**", "!**/pages/404/**"]); - - const urlPaths = uncompiledPaths.map((path) => { - // Remove `src/pages/` - let modifiedPath = path.replace(/^src\/pages\//, ""); - // Remove `.mdx` - modifiedPath = modifiedPath.replace(/\.mdx$/, ""); - // Remove `/index` if it's at the end of the path - modifiedPath = modifiedPath.replace(/\/index$/, ""); - return `${BASE_URL}/${modifiedPath}`; - }); - const sitemap = ` - - ${BASE_URL} - daily - 0.7 - - ${urlPaths - .map((url) => { - return ` + ${SITEMAP.map((url) => { + return ` - ${url} + ${BASE_URL}${url} daily 0.7 `; - }) - .join("")} + }).join("")} `;