This commit includes the addition of a contact form and a cookie banner to improve user experience and comply with regulations. The contact form involves email submission functionality. Several packages have also been updated and new routes have been added to the sitemap for better SEO. Environment variables have also been adjusted for email and contact form functionality.
63 lines
1.3 KiB
TypeScript
63 lines
1.3 KiB
TypeScript
import { getServerSideSitemap } from 'next-sitemap';
|
|
|
|
import { createCmsClient } from '@kit/cms';
|
|
|
|
import appConfig from '~/config/app.config';
|
|
|
|
export async function GET() {
|
|
const urls = getSiteUrls();
|
|
|
|
const items = await getAllItems();
|
|
|
|
return getServerSideSitemap([
|
|
...urls,
|
|
...items.map((path) => {
|
|
return {
|
|
loc: new URL(path, appConfig.url).href,
|
|
lastmod: new Date().toISOString(),
|
|
};
|
|
}),
|
|
]);
|
|
}
|
|
|
|
function getSiteUrls() {
|
|
const urls = [
|
|
'/',
|
|
'/faq',
|
|
'/blog',
|
|
'/docs',
|
|
'/pricing',
|
|
'/contact',
|
|
'/cookie-policy',
|
|
'/terms-of-service',
|
|
'/privacy-policy',
|
|
];
|
|
|
|
return urls.map((url) => {
|
|
return {
|
|
loc: new URL(url, appConfig.url).href,
|
|
lastmod: new Date().toISOString(),
|
|
};
|
|
});
|
|
}
|
|
|
|
async function getAllItems() {
|
|
const client = await createCmsClient();
|
|
|
|
const posts = client
|
|
.getContentItems({
|
|
collection: 'posts',
|
|
})
|
|
.then((response) => response.items)
|
|
.then((posts) => posts.map((post) => `/blog/${post.slug}`));
|
|
|
|
const docs = client
|
|
.getContentItems({
|
|
collection: 'documentation',
|
|
})
|
|
.then((response) => response.items)
|
|
.then((docs) => docs.map((doc) => `/docs/${doc.slug}`));
|
|
|
|
return Promise.all([posts, docs]).then((items) => items.flat());
|
|
}
|