Skip to content

Commit

Permalink
chore(docs): debug
Browse files Browse the repository at this point in the history
  • Loading branch information
krisantrobus committed Dec 20, 2024
1 parent 9df3799 commit 30b3592
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions packages/paste-website/src/pages/sitemap.xml.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { globby } from "globby-esm";
import type { GetServerSideProps } from "next";

Check failure on line 2 in packages/paste-website/src/pages/sitemap.xml.tsx

View workflow job for this annotation

GitHub Actions / Lint repository

There should be at least one empty line between import groups
import { SITEMAP } from "../../../../cypress/integration/sitemap-vrt/constants"; // Import the SITEMAP
import { SITEMAP } from "../../../../cypress/integration/sitemap-vrt/constants"; // Import the SITEMAP used for cypress

const Sitemap = (): React.ReactElement | null => {
return null;
};

export const revalidate = "force-cache";


export const getServerSideProps: GetServerSideProps = async ({ res }) => {
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
Expand Down Expand Up @@ -38,6 +35,31 @@ export const getServerSideProps: GetServerSideProps = async ({ res }) => {
// eslint-disable-next-line no-console
console.log("SITEMAP_LOCAL:", SITEMAP);

const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>${BASE_URL}</loc>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
${urlPaths
.map((url) => {
return `
<url>
<loc>${url}</loc>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
`;
})
.join("")}
</urlset>
`;

res.setHeader("Content-Type", "text/xml");
res.write(sitemap);
res.end();

return {
props: {},
};
Expand Down

0 comments on commit 30b3592

Please sign in to comment.