From 357f378336f38e7f5b07395d1adb243f10879e26 Mon Sep 17 00:00:00 2001 From: krisantrobus <55083528+krisantrobus@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:26:23 -0600 Subject: [PATCH] chore(docs): fix sitemap (#4200) * chore(docs): fix sitemap caching * chore(docs): cahnge sitemap to use uncompiled paths * chore(docs): add root to sitemap * chore(docs): test different sitemap * chore(docs): test different sitemap * chore(docs): attempt moving readme file * chore(docs): use cwd * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): debug * chore(docs): final sitemap --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- cypress/integration/sitemap-vrt/constants.ts | 2 +- .../paste-website/src/pages/sitemap.xml.tsx | 33 ++++--------------- 2 files changed, 7 insertions(+), 28 deletions(-) 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("")} `;