Sitemap.xml fixed
This commit is contained in:
+3
-8
@@ -33,14 +33,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;
|
||||
};
|
||||
/**
|
||||
* Bundles the per-request data helpers a frontend needs — the same cached
|
||||
@@ -68,7 +63,7 @@ type CreateContentHelpersArgs = {
|
||||
* a URL is, fetching gets the listing. Metadata generation needs the first and
|
||||
* not the second, and a page component composes them in two obvious lines.
|
||||
*/
|
||||
export declare function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug, robots: robotsOptions, settingsSlug, sitemapStyle, siteNameField, }: CreateContentHelpersArgs): {
|
||||
export declare function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug, robots: robotsOptions, settingsSlug, sitemapStyle, }: CreateContentHelpersArgs): {
|
||||
generatePageMetadata: (locale: string, segments: string[] | undefined, page?: number) => Promise<PageMetadata>;
|
||||
generateStaticParams: () => Promise<Array<{
|
||||
locale: string;
|
||||
|
||||
+2
-13
@@ -27,7 +27,7 @@ import { buildRobots, buildSitemapEntries, createPageMetadata, createSitemapRout
|
||||
* `resolveRoute` and `getEntries` are separate on purpose: routing decides what
|
||||
* a URL is, fetching gets the listing. Metadata generation needs the first and
|
||||
* not the second, and a page component composes them in two obvious lines.
|
||||
*/ export function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug = 'pages', robots: robotsOptions, settingsSlug = 'site-settings', sitemapStyle, siteNameField = 'siteName' }) {
|
||||
*/ export function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug = 'pages', robots: robotsOptions, settingsSlug = 'site-settings', sitemapStyle }) {
|
||||
const origin = baseUrl ?? process.env.NEXT_PUBLIC_SERVER_URL ?? '';
|
||||
const getCachedPayload = cache(async ()=>getPayload({
|
||||
config: await config
|
||||
@@ -318,18 +318,7 @@ import { buildRobots, buildSitemapEntries, createPageMetadata, createSitemapRout
|
||||
* 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);
|
||||
const name = s?.[siteNameField];
|
||||
return typeof name === 'string' ? name : undefined;
|
||||
})
|
||||
}
|
||||
style: sitemapStyle ?? {}
|
||||
});
|
||||
return {
|
||||
generatePageMetadata,
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user