Files
myeasycms-v2/apps/web/app/server-sitemap.xml/route.ts
giancarlo cb8b23e8c0 Remove billing and checkout redirect buttons and related services
Deleted the billing-redirect-button, checkout-redirect-button, and embedded-stripe-checkout components. Additionally, removed the shadcn directory, which encompassed billing-related icons. This change streamlines the subscription settings interface and organizes the system's payment management. This update is a stepping stone towards improving the billing system's overall architecture.
2024-03-25 11:39:41 +08:00

51 lines
1.2 KiB
TypeScript

import appConfig from '@/config/app.config';
import { invariant } from '@epic-web/invariant';
import { allDocumentationPages, allPosts } from 'contentlayer/generated';
import { getServerSideSitemap } from 'next-sitemap';
import { join } from 'path';
const siteUrl = appConfig.url;
export async function GET() {
const urls = getSiteUrls();
const posts = getPostsSitemap();
const docs = getDocsSitemap();
return getServerSideSitemap([...urls, ...posts, ...docs]);
}
function getSiteUrls() {
invariant(siteUrl, 'No NEXT_PUBLIC_SITE_URL found');
const urls = ['', 'faq', 'pricing'];
return urls.map((url) => {
return {
loc: join(siteUrl, url),
lastmod: new Date().toISOString(),
};
});
}
function getPostsSitemap() {
invariant(siteUrl, 'No NEXT_PUBLIC_SITE_URL found');
return allPosts.map((post) => {
return {
loc: join(siteUrl, post.url),
lastmod: new Date().toISOString(),
};
});
}
function getDocsSitemap() {
invariant(siteUrl, 'No NEXT_PUBLIC_SITE_URL found');
return allDocumentationPages.map((page) => {
return {
loc: join(siteUrl, page.url),
lastmod: new Date().toISOString(),
};
});
}