ต้องแก้ไขอย่างไรค่ะ Code ทำ google structured
โค้ด: เลือกทั้งหมด
<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$doc = JFactory::getDocument();
$doc->addScript(JUri::root() . 'templates/***/js/prism.js');
$doc->addStyleSheet(JUri::root() . 'templates/***/css/prism.css');
// Create shortcuts to some parameters.
$params = $this->item->params;
$images = json_decode($this->item->images);
$urls = json_decode($this->item->urls);
$canEdit = $params->get('access-edit');
$user = JFactory::getUser();
$info = $params->get('info_block_position', 0);
JHtml::_('behavior.caption');
$image_default = 'images/logo.png';
$name_type_article = '';
$url_type_article = '';
if ($params->get('show_title') == 1 || $params->get('show_author') ==1) :
$name_type_article = $this->escape($this->item->title);
$url_type_article = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->id, $this->item->catid, $this->item->language));
endif;
$google_structured=array(
"@context" => "http://schema.org",
"@type"=> "Article",
"name"=> $name_type_article,
"url"=> $url_type_article,
);
$doc->addScriptDeclaration( json_encode($google_structured), 'application/ld+json');
?>