MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 12: | Line 12: | ||
const pageTitle = mw.config.get('wgTitle'); | const pageTitle = mw.config.get('wgTitle'); | ||
let schema = null; | |||
// COMPANY (Infobox company) | |||
if (infobox.innerHTML.toLowerCase().includes('industry') | |||
&& infobox.innerHTML.toLowerCase().includes('founded')) { | |||
schema = { | schema = { | ||
"@context": "https://schema.org", | "@context": "https://schema.org", | ||
| Line 27: | Line 25: | ||
"description": metaDesc | "description": metaDesc | ||
}; | }; | ||
const logo = infobox.querySelector('img')?.src; | const logo = infobox.querySelector('img')?.src; | ||
if (logo) schema.logo = logo; | if (logo) schema.logo = logo; | ||
} | } | ||
// PERSON | // PERSON (Infobox person) | ||
else if ( | else if (infobox.innerHTML.toLowerCase().includes('born')) { | ||
schema = { | schema = { | ||
"@context": "https://schema.org", | "@context": "https://schema.org", | ||
| Line 40: | Line 40: | ||
"description": metaDesc | "description": metaDesc | ||
}; | }; | ||
const image = infobox.querySelector('img')?.src; | const image = infobox.querySelector('img')?.src; | ||
if (image) schema.image = image; | if (image) schema.image = image; | ||
} | } | ||