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