Configuration > Sitemap
Sitemap generation is made super easy by using Suncel CMS. How does it work?
Create a file sitemap.xml.ts
in the pages folder
Use the sitemapGenerator
function to generate the sitemap. All pages made with Suncel will be automatically added to the sitemap (unless otherwise specified).
// pages/sitemap.xml.ts
import { GetServerSideProps } from "next/types";
import { sitemapGenerator } from "@suncel/nextjs";
const Sitemap = () => null;
export const getServerSideProps: GetServerSideProps = async (ctx) => {
return sitemapGenerator(ctx);
};
export default Sitemap;
If your project has multiple sitemaps, check this documentation.
You can rename the sitemap.xml.ts
into suncel-sitemap.xml.ts
and include this suncel-sitemap in your sitemap index:
// public/sitemap-index.xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://my-website.io/sitemap.xml</loc>
</sitemap>
<sitemap>
<loc>https://my-website.io/suncel-sitemap.xml</loc>
</sitemap>
</sitemapindex>