/** * Pure, framework-free locale/URL helpers shared by the SEO builders (`seo.ts`) and the React * components, so a page's URL is built exactly one way everywhere - eliminating any drift * between the rendered links and the canonical/hreflang metadata. Kept fs-free (no `node:fs`, * no `next`/`react` import): the folder-based content layout is walked by each backend reader, * while this module only turns a `(slug, lang)` pair into a URL path. * * The locale-prefix math is delegated to `@daanvandenbergh/i18nkit`'s {@link I18n.prefixFor} * (the "default at bare URLs, others under `/`" scheme, or `prefix-all` when the default is * prefixed too), rather than reimplemented here. `localePath` stays a pure function of plain * serializable inputs - not an `I18n` instance - because it is also called from a client * component (`BlogOverviewGrid`), across which a class instance cannot be passed as a prop. */ /** * Normalises a base path: guarantees a single leading slash and strips any trailing slash, so * callers can append URL segments with a plain `/`. * * @param basePath - the configured base path (e.g. `/blog`, `docs/`); defaults to `/blog`. * @returns the normalised base path without a trailing slash (e.g. `/blog`, `/docs`). */ export declare function normalizeBasePath(basePath: string | undefined): string; /** * Builds the root-relative URL path for a page - or, when `slug` is omitted, for a locale's * index page. The single source of truth shared by the SEO metadata and the rendered links: * every locale is prefixed with its code at the very front of the path (`//`, * e.g. `/fr/docs/getting-started`), except the default locale, which is served unprefixed * (`/`) unless `prefixDefaultLocale` is set - useful when every locale should route * through a single `[lang]` segment (`/en/docs/...`, `/fr/docs/...`). * * A section mounted at the site root passes `basePath: ""`, giving `/` and `/` for the index. * * Paths end in a slash (`/docs/getting-started/`, `/docs/`) unless `trailingSlash: false` is passed * - see {@link SiteConfig.trailingSlash} for why this must match the host app's `next.config`. The * site root is always exactly `/`, under either setting. * * @param opts.basePath - the section base path; defaults to `/blog`. Pass `""` to mount at the root. * @param opts.defaultLocale - the locale code served without a prefix (unless prefixed below). * @param opts.lang - the target locale code. * @param opts.slug - the page slug; omit for the locale's index URL. * On a domain-per-locale site (`domainPerLocale: true`) the origin carries the locale, so no locale * is prefixed: every locale's page is `/` on its own domain. * * @param opts.prefixDefaultLocale - when `true`, the default locale is prefixed too. * @param opts.domainPerLocale - when `true`, no locale is prefixed (one domain per locale; see * `SiteConfig.localeOrigins`). Defaults to `false`. * @param opts.trailingSlash - when `false`, omit the trailing slash on a page URL. Defaults to `true`. * @returns the root-relative URL path (resolves against `metadataBase`, like the canonical). */ export declare function localePath(opts: { basePath?: string | undefined; defaultLocale: string; lang: string; slug?: string | undefined; prefixDefaultLocale?: boolean | undefined; domainPerLocale?: boolean | undefined; trailingSlash?: boolean | undefined; }): string;