This commit is contained in:
2026-07-31 23:21:51 +02:00
parent f6b4b36df8
commit f14f2cfd98
294 changed files with 5880 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import { archiveFieldName } from './types.js';
/**
* Builds one relationship field per content collection, pointing at the
* client's Pages collection.
*
* Sits alongside the system-page roles (homepage, privacy policy) because it's
* the same idea: a page referenced by function rather than by slug. The
* assignment is locale-agnostic — one page document — while the resulting path
* is locale-aware, since the page's slug is localized. Assign the "Artykuły"
* page once and you get /pl/artykuly and /en/articles from its own slugs.
*/ export function buildArchiveFields(content, pagesSlug) {
return content.collections.map((collection)=>{
const label = collection.label ?? collection.slug;
return {
name: archiveFieldName(collection.slug),
type: 'relationship',
admin: {
description: `Page listing ${label}. Its slug becomes the URL segment for entries (e.g. /pl/artykuly/moj-wpis).`
},
label: `${label} — archive page`,
maxDepth: 1,
relationTo: pagesSlug
};
});
}
//# sourceMappingURL=archiveFields.js.map