/** * Reads the site-wide inputs to title and URL composition from SiteSettings. * * Split out of metadata assembly because these are one concern with one source: * whatever an editor set in the panel. Metadata generation shouldn't also know * that the separator arrives unpadded, or that the home slug hides inside a * relationship — it should receive a resolved config. */ export async function readSiteMetaConfig({ locale, payload, settingsSlug = 'site-settings', siteNameField = 'siteName' }) { // depth 1 populates the homepage relationship, so its slug is available // without a second query. const settings = await payload.findGlobal({ slug: settingsSlug, depth: 1, locale: locale }); const homepage = settings.homepage && typeof settings.homepage === 'object' ? settings.homepage : null; return { siteName: settings[siteNameField] ?? null, // The panel stores '|'; titles need it padded. homeSlug: typeof homepage?.slug === 'string' ? homepage.slug : undefined, order: settings.titleOrder ?? undefined, separator: settings.titleSeparator ? ` ${settings.titleSeparator} ` : undefined }; } //# sourceMappingURL=readSiteMetaConfig.js.map