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
-35
View File
@@ -1,35 +0,0 @@
import { buildLocalizedPath, getLocaleCodes } from '../i18n/index.js';
/**
* Builds a map of locale → URL for hreflang alternate links, suitable for
* Next.js Metadata `alternates.languages`.
*
* Bridges SEO and i18n: for each configured locale that the document has a
* slug in, it produces the locale-aware path (via buildLocalizedPath),
* optionally prefixed with an absolute origin.
*
* @example
* buildHreflangAlternates({
* slugs: { pl: 'o-nas', en: 'about' },
* config,
* baseUrl: 'https://example.com',
* })
* // → { pl: 'https://example.com/pl/o-nas', en: 'https://example.com/en/about' }
*/ export function buildHreflangAlternates({ baseUrl, config, homeSlug = 'home', prefix, slugs }) {
const origin = baseUrl?.replace(/\/$/, '') ?? '';
const alternates = {};
for (const locale of getLocaleCodes(config)){
const path = buildLocalizedPath({
config,
homeSlug,
locale,
prefix,
slugs
});
if (path) {
alternates[locale] = `${origin}${path}`;
}
}
return alternates;
}
//# sourceMappingURL=hreflang.js.map