Solutions
To add this meta tag in you <head>
section of a Joomla website:
<meta itemprop="name" content="title of your content">
You can use one of the following solutions
1) Add this code in the <head>
section:
echo JMicrodata::htmlMeta($content = 'title', $property = 'name');
2) In whatever part of your code/file you want:
$microdata = JMicrodata::htmlMeta($content = 'title', $property = 'name');
$document = JFactory::getDocument();
$document->addCustomTag($microdata);
Documentation help
JMicrodata::htmlMeta()
is used for output microdata semantics in a meta tag, this method does not add the meta tag in the <head>
section.
I see you use $scope="itemprop"
, which is wrong, the scope is used to specify the Type of microdata, here you can find the full list of the available Types http://schema.org/docs/full.html
I suggest you to use an instance of JMicrodata
, this way you don't need to worry that microdata is displayed properly.
$microdata = new JMicrodata('Article');
echo $microdata->content('title')->property('name')->display('meta');