Developer - Extend Structured Data with Joomla Plugins

Heads up! This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Customize and extend Google Structured Data extension with PHP code.

onGSDSchemaBeforeGenerate

This event fires immediately before the generation of the JSON-LD script that will be injected into the <head> of the page. It passes the $schema array variable by reference which includes all the schema properties. This is rather useful when you want to modify a schema property with a value fetched from the database or another extension.

Parameters

$schema (array) The schema.org properties
$data (object) The structured data item as configured in the backend

Source

administrator/components/com_gsd/GSD/Json.php

Syntax

public function onGSDSchemaBeforeGenerate(&$schema, $data)
{
	$schema['myProperty'] = 'myValue';
}
Last updated on Oct 29th 2024 14:10