fix: drupal-meta — Array.isArray narrowing for custom tags union type

This commit is contained in:
BarnacleBoy 2026-05-18 13:08:55 +00:00
parent 1724a838e2
commit 0dc2a0a570

View file

@ -60,19 +60,21 @@ export function generateDrupalNodeMeta(
}
// Add sticky/promote as robots meta
if (attributes.sticky || attributes.promote) {
meta.custom?.push({
name: 'robots',
content: 'index, follow',
})
}
if (meta.custom && Array.isArray(meta.custom)) {
if (attributes.sticky || attributes.promote) {
meta.custom.push({
name: 'robots',
content: 'index, follow',
})
}
// Add status-based robots meta
if (!attributes.status) {
meta.custom?.push({
name: 'robots',
content: 'noindex, nofollow',
})
// Add status-based robots meta
if (!attributes.status) {
meta.custom.push({
name: 'robots',
content: 'noindex, nofollow',
})
}
}
return meta
@ -98,7 +100,7 @@ export function generateArticleContentMeta(
type: 'article',
},
custom: [
...(baseMeta.custom || []),
...(Array.isArray(baseMeta.custom) ? baseMeta.custom : []),
// Article-specific meta tags
{
property: 'article:section',
@ -151,7 +153,7 @@ export function generateLearningResourceMeta(
type: 'article',
},
custom: [
...(baseMeta.custom || []),
...(Array.isArray(baseMeta.custom) ? baseMeta.custom : []),
// Learning resource-specific meta tags
{
name: 'resource-type',