Suncel home pageSuncel logoSuncel v1.1
  1. Sitemap

Configuration > Sitemap

Sitemap

Sitemap generation is made super easy by using Suncel CMS. How does it work?

Create the Sitemap file

Create a file sitemap.xml.ts in the pages folder

Sitemap folder

Generate the sitemap

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;

Multiple sitemaps

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:

Example

// 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>