Initial commit

This commit is contained in:
2026-08-02 20:55:23 +02:00
parent 411f484b40
commit d558d18d9a
295 changed files with 9 additions and 5880 deletions
-36
View File
@@ -1,36 +0,0 @@
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