fix: drupal-meta — Array.isArray narrowing for custom tags union type
This commit is contained in:
parent
1724a838e2
commit
0dc2a0a570
1 changed files with 16 additions and 14 deletions
|
|
@ -60,19 +60,21 @@ export function generateDrupalNodeMeta(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add sticky/promote as robots meta
|
// Add sticky/promote as robots meta
|
||||||
if (attributes.sticky || attributes.promote) {
|
if (meta.custom && Array.isArray(meta.custom)) {
|
||||||
meta.custom?.push({
|
if (attributes.sticky || attributes.promote) {
|
||||||
name: 'robots',
|
meta.custom.push({
|
||||||
content: 'index, follow',
|
name: 'robots',
|
||||||
})
|
content: 'index, follow',
|
||||||
}
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 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',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue