Sitemap.xml fixed

This commit is contained in:
2026-10-14 11:32:03 +02:00
parent fad5d778e8
commit f4d969ad29
9 changed files with 14 additions and 52 deletions
+3 -23
View File
@@ -41,12 +41,9 @@ type CreateContentHelpersArgs = {
settingsSlug?: string
/**
* Browser look of `sitemapRoute` (/sitemap.xml). Default: built-in style,
* header = Site Settings `siteName` (default locale), credit "Technology by
* Intecion.com". `false` = raw XML. `{ credit: false }` hides the credit line.
* header "XML Sitemap", credit "Technology by Intecion.com". `false` = raw XML.
*/
sitemapStyle?: { title?: string } & Omit<SitemapStyleOptions, 'title'> | false
/** Site Settings field with the site name (sitemap header). Default 'siteName'. */
siteNameField?: string
sitemapStyle?: false | SitemapStyleOptions
}
/**
@@ -84,7 +81,6 @@ export function createContentHelpers({
robots: robotsOptions,
settingsSlug = 'site-settings',
sitemapStyle,
siteNameField = 'siteName',
}: CreateContentHelpersArgs) {
const origin = baseUrl ?? process.env.NEXT_PUBLIC_SERVER_URL ?? ''
const getCachedPayload = cache(
@@ -401,23 +397,7 @@ export function createContentHelpers({
* export { sitemapRoute as GET } from '@/lib/content'
* export const dynamic = 'force-dynamic'
*/
const sitemapRoute = createSitemapRouteHandler(sitemap, {
style:
sitemapStyle === false
? false
: {
...sitemapStyle,
title:
sitemapStyle?.title ??
(async () => {
const locale = i18n?.defaultLocale
if (!locale) {return undefined}
const s = (await getSettings(locale)) as Record<string, unknown>
const name = s?.[siteNameField]
return typeof name === 'string' ? name : undefined
}),
},
})
const sitemapRoute = createSitemapRouteHandler(sitemap, { style: sitemapStyle ?? {} })
return {
generatePageMetadata,
+1 -1
View File
@@ -13,7 +13,7 @@ export type SitemapStyleOptions = {
* "Technology by Intecion.com". `false` hides it.
*/
credit?: false | string
/** Header line. Default: the site name from Site Settings (sitemapRoute), else "XML Sitemap". */
/** Header line. Default "XML Sitemap". */
title?: string
}