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 { buildAutoFillMetaHook } from './autoFillMeta.js';
/**
* Injects the auto-fill meta hook into every SEO-enabled collection.
*
* Runs after @payloadcms/plugin-seo has added the meta group, appending a
* beforeChange hook that fills empty meta from document content. Existing
* hooks are preserved (plugin hook runs last, so editor input and other hooks
* win first).
*/ export function injectAutoFillMeta(config, seo) {
// autoFill disabled explicitly — leave collections untouched
if (seo.autoFill === false) {
return config;
}
const hook = buildAutoFillMetaHook(seo.autoFill);
return {
...config,
collections: (config.collections ?? []).map((collection)=>{
if (!seo.collections.includes(collection.slug)) {
return collection;
}
return {
...collection,
hooks: {
...collection.hooks,
beforeChange: [
...collection.hooks?.beforeChange ?? [],
hook
]
}
};
})
};
}
//# sourceMappingURL=injectAutoFillMeta.js.map