Extension:GoogleRichCards

Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
GoogleRichCards
Release status: betaCategory:Beta status extensions
Implementation User interfaceCategory:User interface extensions
Description MediaWiki extension for automated Google Rich Cards generation
Author(s) IgorShishkintalk
Latest version 0.2 (2025-07-28)
MediaWiki 1.43+Category:Extensions with manual MediaWiki version
PHP 8.1+
License GNU General Public License 2.0 only
Download Category:Extensions in GitHub version control
Readme
seo, meta, google rich cards
Category:All extensionsCategory:Extensions not in ExtensionJson

The GoogleRichCards extension automatically generates Google Rich Cards in JSON+LD format for MediaWiki article pages.

Installation

  • Download and place the file(s) in a directory called GoogleRichCards in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'GoogleRichCards' );
    
  • Clear the cache of your browser
  • Clear MediaWiki page cache (if enabled)
  • Reload any MediaWiki article page
  • Check the HTML source and confirm the presence of following lines before </head> (values could differ according to the page content):
<script type="application/ld+json">
{
	"@context": "http://schema.org",
	"@type": "Article",
	"mainEntityOfPage": {
		"@type": "WebPage",
		"@id": "<current page URL>"
	},
	"author": {
		"@type": "Person",
		"name": "<first revision author>"
	},
	"headline": "<current page title>",
	"dateCreated": "2016-05-04T08:20:51+00:00",
	"datePublished": "2016-05-04T08:20:51+00:00",
	"discussionUrl": "<current page talk link>",
	"dateModified": "2016-06-05T01:12:10+00:00",
	"image": {
		"@type": "ImageObject",
		"url": "<first image on the article or $wgLogo>",
		"height": <height>,
		"width": <width>
	},
	"publisher": {
		"@type": "Organization",
		"name": "<wiki name>",
		"logo": {
			"@type": "ImageObject",
			"url": "<logo URL made of $wgServer + $wgLogo>"
		}
	},
	"description": "<page title>"
}
</script>
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

This extension has three configuration variables which control what (if anything) the extension does. By default annotations are enabled for pages in content namespaces and the WebSite annotations are also enabled, but event annotations and the <event> parser tag are not enabled.

NameDescriptionDefault
$wgGoogleRichCardsAnnotateArticlesEnable annotations for articles (content pages)?true
$wgGoogleRichCardsAnnotateEventsEnable annotations for events + enable the <event> parser hook?false
$wgGoogleRichCardsAnnotateWebSiteEnable WebSite annotations?true
Category:HTML head extensions Category:Search engine optimization extensions
Category:All extensions Category:BeforePageDisplay extensions Category:Beta status extensions Category:Extensions in GitHub version control Category:Extensions not in ExtensionJson Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:HTML head extensions Category:ParserFirstCallInit extensions Category:Search engine optimization extensions Category:User interface extensions