MediaWiki:Common.js: Difference between revisions
Startupedia (talk | contribs) Removed redirect Tag: Manual revert |
Startupedia (talk | contribs) Updated schema markup |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
$(function () { | $(document).ready(function() { | ||
// Create a <script> tag for schema markup | |||
var schemaScript = document.createElement('script'); | |||
schemaScript.type = 'application/ld+json'; | |||
schemaScript.text = JSON.stringify({ | |||
"@context": "http://schema.org", | |||
"@type": "WebSite", | |||
"name": "Startupidia", | |||
"url": "https://startupidia.org", | |||
"description": "Startupidia is an innovative, dedicated encyclopedia designed to serve as a comprehensive resource for the startup ecosystem.", | |||
} | "publisher": { | ||
"@type": "Organization", | |||
"name": "Startupidia", | |||
"url": "https://startupidia.org", | |||
"logo": { | |||
"@type": "ImageObject", | |||
"url": "https://startupidia.org/resources/assets/Startupeidia_Logo.png", | |||
"caption": "Startupidia Logo" | |||
} | |||
}, | |||
"potentialAction": { | |||
"@type": "SearchAction", | |||
"target": "https://startupidia.org/index.php?title=Special:Search&search={search_term_string}", | |||
"query-input": "required name=search_term_string" | |||
} | |||
}); | |||
document.head.appendChild(schemaScript); | |||
// Add Open Graph meta tags | |||
var metaTags = [ | |||
{ property: "og:site_name", content: "Startupidia" }, | |||
{ property: "og:title", content: "Startupidia" }, | |||
{ property: "og:url", content: "https://startupidia.org" }, | |||
{ property: "og:description", content: "Startupidia is an innovative, dedicated encyclopedia designed to serve as a comprehensive resource for the startup ecosystem." }, | |||
{ property: "og:image", content: "https://startupidia.org/resources/assets/Startupeidia_Logo.png" } | |||
]; | |||
metaTags.forEach(function(tag) { | |||
var meta = document.createElement('meta'); | |||
meta.setAttribute('property', tag.property); | |||
meta.setAttribute('content', tag.content); | |||
document.head.appendChild(meta); | |||
}); | |||
// Add canonical tag | |||
var canonical = document.createElement('link'); | |||
canonical.rel = 'canonical'; | |||
canonical.href = 'https://startupidia.org'; | |||
document.head.appendChild(canonical); | |||
}); | }); | ||
Revision as of 16:57, 21 July 2025
/* Any JavaScript here will be loaded for all users on every page load. */ $(document).ready(function() { // Create a <script> tag for schema markup var schemaScript = document.createElement('script'); schemaScript.type = 'application/ld+json'; schemaScript.text = JSON.stringify({ "@context": "http://schema.org", "@type": "WebSite", "name": "Startupidia", "url": "https://startupidia.org", "description": "Startupidia is an innovative, dedicated encyclopedia designed to serve as a comprehensive resource for the startup ecosystem.", "publisher": { "@type": "Organization", "name": "Startupidia", "url": "https://startupidia.org", "logo": { "@type": "ImageObject", "url": "https://startupidia.org/resources/assets/Startupeidia_Logo.png", "caption": "Startupidia Logo" } }, "potentialAction": { "@type": "SearchAction", "target": "https://startupidia.org/index.php?title=Special:Search&search={search_term_string}", "query-input": "required name=search_term_string" } }); document.head.appendChild(schemaScript); // Add Open Graph meta tags var metaTags = [ { property: "og:site_name", content: "Startupidia" }, { property: "og:title", content: "Startupidia" }, { property: "og:url", content: "https://startupidia.org" }, { property: "og:description", content: "Startupidia is an innovative, dedicated encyclopedia designed to serve as a comprehensive resource for the startup ecosystem." }, { property: "og:image", content: "https://startupidia.org/resources/assets/Startupeidia_Logo.png" } ]; metaTags.forEach(function(tag) { var meta = document.createElement('meta'); meta.setAttribute('property', tag.property); meta.setAttribute('content', tag.content); document.head.appendChild(meta); }); // Add canonical tag var canonical = document.createElement('link'); canonical.rel = 'canonical'; canonical.href = 'https://startupidia.org'; document.head.appendChild(canonical); }); $(function () { $('a.external').attr('target', '_blank'); });