fix: use Object.hasOwn to check for existing frontmatter fields before injecting custom taxonomy slugs

This commit is contained in:
2026-03-12 14:23:15 +09:00
parent fc095a2b50
commit 287af36d7d
+1 -1
View File
@@ -226,7 +226,7 @@ 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)) {
if (Object.hasOwn(post.frontmatter, domain)) {
console.warn(`⚠️ Skipping custom taxonomy '${domain}' on post '${post.slug}' because it conflicts with an existing frontmatter field.`);
return;
}