Generates XML sitemap of all application routes for search engines.
// Source: https://github.com/ncdai/chanhdai.com | License: MIT | Copyright 2026 Chánh Đại
// Provided via justclaw.it.com; keep this notice with the code.
import type { MetadataRoute } from "next"
import { blockCategories } from "@/config/registry"
import { SITE_INFO } from "@/config/site"
import { getAllBlockStaticParams } from "@/lib/blocks"
import { getBlogPosts, getComponentDocs } from "@/features/doc/data/documents"
export const revalidate = false
export const dynamic = "force-static"
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const posts = getBlogPosts().map((post) => ({
url: `${SITE_INFO.url}/blog/${post.slug}`,
lastModified: new Date(post.metadata.updatedAt).toISOString(),
}))
const components = getComponentDocs().map((post) => ({
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key