TASKS-1823 WebManager module
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import type { MetadataRoute } from 'next';
|
||||
import { getWebRuntimeAPI } from '#web-runtime/api/web-runtime-api';
|
||||
import { siteUrl } from '#web-runtime/lib/site-url';
|
||||
import { buildSitemap } from '#web-runtime/lib/sitemap';
|
||||
import { getPathname } from '#i18n/navigation';
|
||||
|
||||
function publicPath(locale: string, path: string): string {
|
||||
return getPathname({ locale, href: path ? `/${path}` : '/' });
|
||||
}
|
||||
|
||||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
const entries = await getWebRuntimeAPI().listSitemapPages();
|
||||
|
||||
return buildSitemap(entries, siteUrl(), publicPath);
|
||||
}
|
||||
Reference in New Issue
Block a user