From 351b877c05ceb7f7d5227b0f79736bd19e220a9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jul 2019 14:39:22 +0200 Subject: [PATCH] Add structured data product --- htdocs/core/lib/website.lib.php | 70 ++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 10ba1707bf1..08ccdb05246 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -437,17 +437,41 @@ function includeContainer($containerref) /** * Return HTML content to add structured data for an article, news or Blog Post. * - * @param string $type 'blogpost', 'product', ... + * @param string $type 'blogpost', 'product', 'software'... * @param WebsitePage $websitepage Website page object + * @param array $data Array of data parameters for structured data * @return string HTML content */ -function getStructuredData($type, WebsitePage $websitepage) +function getStructuredData($type, WebsitePage $websitepage, $data = array()) { global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $weblangs; // Very important. Required to have var available when running inluded containers. global $includehtmlcontentopened; global $websitekey, $websitepagefile; - if ($type == 'blogpost') + if ($type == 'software') + { + $ret = ''."\n"; + $ret .= ''."\n"; + } + elseif ($type == 'blogpost') { if ($websitepage->fk_user_creat > 0) { @@ -486,13 +510,47 @@ function getStructuredData($type, WebsitePage $websitepage) }, "description": "'.$websitepage->description.'" }'."\n"; - /* - */ $ret .= ''."\n"; } } } - + elseif ($type == 'product') + { + $ret = ''."\n"; + $ret.= ''."\n"; + } return $ret; }