Keyword

Google Rich Snippets / Structured Data

  • NormanBLN
  • NormanBLN's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 2 months ago - 8 years 2 months ago #150579 by NormanBLN
Google Rich Snippets / Structured Data was created by NormanBLN
I need a little bit help.
I try to optimize our template with googls rich snippeds.
1 ) itemprop datePublished / dateModified
We use
datePublished:
<?php echo JHTML::_('date', $this->item->created,JText::_('K2_DATE_FORMAT_LC2')); ?>
dateModified:
<?php echo JHTML::_('date', $item->created,JText::_('K2_DATE_FORMAT_LC2')); ?>
and I received :
datePublished: Donnerstag, 31 Dezember 2015 12:56
dateModified: 2016-01-12T11:04:00

The Problem is we need the date format (datePublished) in ISO 8601 for example '2013-02-14T13:15:03-08:00' (YYYY-MM-DDTHH:mm:ssZ). What we have to do?

2 ) itemprop description
How I can call the meta description for this article? We try it with the intro text but this is for us not helpful :/
Last edit: 8 years 2 months ago by NormanBLN.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 2 months ago #150582 by Krikor Boghossian
Replied by Krikor Boghossian on topic Google Rich Snippets / Structured Data
You have the modified date code wrong, you need to check K2's default template and use the default PHP code.

You can see an example of an item with structured data here github.com/kricore/Advanced-templating-with-K2/blob/master/default/item.php

Do not c/p all the code, it is for a different version of K2, just the itemprop values.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • NormanBLN
  • NormanBLN's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 2 months ago - 8 years 2 months ago #150589 by NormanBLN
Replied by NormanBLN on topic Google Rich Snippets / Structured Data
Hi Krikor,

thanks a lot for your answer, but for my first question does not help.
'datePublished' is required but not incudet in the default and you use exacat the same code
<?php echo JHtml::_('date', $this->item->created, JText::_('K2_DATE_FORMAT_LC2')); ?>
but we received the date format not in this style 2013-02-14T13:15:03-08:00 but in this Donnerstag, 31 Dezember 2015 12:56

Also I can't found itemprop="description" or "mainEntityOfPage" in the default item.

One More
If we use from the default item:
<div id="k2Container" class="itemView<?php echo ($this->item->featured) ? ' itemIsFeatured' : ''; ?><?php if ($this->item->params->get('pageclass_sfx')) echo ' ' . $this->item->params->get('pageclass_sfx'); ?>" itemscope itemtype="http://schema.org/Article">
we receive
Article 1: https://offe.....ich.de/z4check/k2Container

PS. We use the last k2 v2.6.9

Greetings Norman
Last edit: 8 years 2 months ago by NormanBLN.

Please Log in or Create an account to join the conversation.

More
8 years 2 months ago #150605 by German Levi
Replied by German Levi on topic Google Rich Snippets / Structured Data
I'm doing a date like this! Can lay out the entire pattern! This topic has already been raised on the forum
<?php if($this->item->params->get('itemDateModified') && intval($this->item->modified)!=0): ?>
      <!-- Item date modified --> 
      <span class="itemDateModified"> <?php echo JText::_('K2_LAST_MODIFIED_ON'); ?> <?php echo JHTML::_('date', $this->item->modified, JText::_('K2_DATE_FORMAT_LC2')); ?> </span>
      <?php $date_mod = str_replace(" ","T",$this->item->modified)."+03:00"; ?>
      <meta itemprop="datePublished" content="<?php echo $date_mod; ?>"/>
      
      <?php endif; ?>

Please Log in or Create an account to join the conversation.

More
8 years 2 months ago #150606 by German Levi
Replied by German Levi on topic Google Rich Snippets / Structured Data
The meta description can be called via standard class Joomla! JDocument getDescription ()

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 2 months ago #150609 by Krikor Boghossian
Replied by Krikor Boghossian on topic Google Rich Snippets / Structured Data
I usually use the introtext as the itemprop description.
You can also use an extrafield or the $item's meta description. I would use var_dump() to get the item's properties personally.

Now the code in your former post seems ok. The second snippet in your initial post was wrong, it seems that you have corrected it.

Finally the code you added in the item's container will not affect your URLs in any way.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum