fix: prevent overwriting existing frontmatter fields with custom taxonomy slugs

This commit is contained in:
2026-03-12 14:04:33 +09:00
parent 6ccdf2378a
commit 07f0e79e20
+4
View File
@@ -226,6 +226,10 @@ function populateFrontmatter(posts) {
// inject custom taxonomy slugs into frontmatter, each taxonomy as its own field
Object.entries(post.customTaxonomies).forEach(([domain, slugs]) => {
if (slugs.length > 0) {
if (post.frontmatter.hasOwnProperty(domain)) {
console.warn(`⚠️ Skipping custom taxonomy '${domain}' on post '${post.slug}' because it conflicts with an existing frontmatter field.`);
return;
}
post.frontmatter[domain] = slugs;
}
});