added /dist

This commit is contained in:
2026-08-03 12:24:28 +02:00
parent dd97bb67fe
commit 05150e7ece
490 changed files with 6667 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import { buildLocalizedPath, getLocalizedSlugs } from '../i18n/index.js';
/**
* Resolves a system-page assignment to a locale-aware path.
*
* Bridges the Pages module (which document plays a role) and the i18n module
* (how that document's localized slug becomes a URL). This is what powers
* "visit /pl → serve the homepage": read SiteSettings.homepage, pass the
* related document here, get /pl/strona-glowna (or /pl if it's the home slug).
*
* Returns undefined when the role is unassigned or the assigned page has no
* slug in the target locale — the caller decides the fallback (e.g. 404,
* redirect to default locale).
*
* @example
* const settings = await payload.findGlobal({ slug: 'site-settings', locale: 'all', depth: 1 })
* getSystemPagePath({ page: settings.homepage, locale: 'pl', config })
* // → '/pl' (home slug collapses to root)
* getSystemPagePath({ page: settings.privacyPolicy, locale: 'en', config })
* // → '/en/privacy-policy'
*/ export function getSystemPagePath({ config, homeSlug = 'home', locale, page }) {
if (!page?.slug) {
return undefined;
}
const slugs = getLocalizedSlugs({
config,
slugField: page.slug
});
return buildLocalizedPath({
config,
homeSlug,
locale,
slugs
});
}
//# sourceMappingURL=getSystemPagePath.js.map