mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-07-11 18:56:14 +09:00
fix: prevent overwriting existing frontmatter fields with custom taxonomy slugs
This commit is contained in:
@@ -226,6 +226,10 @@ function populateFrontmatter(posts) {
|
|||||||
// inject custom taxonomy slugs into frontmatter, each taxonomy as its own field
|
// inject custom taxonomy slugs into frontmatter, each taxonomy as its own field
|
||||||
Object.entries(post.customTaxonomies).forEach(([domain, slugs]) => {
|
Object.entries(post.customTaxonomies).forEach(([domain, slugs]) => {
|
||||||
if (slugs.length > 0) {
|
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;
|
post.frontmatter[domain] = slugs;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user