Need help with Joomla? We are available for hire to help with Joomla customization, upgrades, maintenance, and custom development.
Explore our services

Adding structured data to Upcoming Events Module

  • Tom Apelt
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 10 months ago - 9 years 10 months ago #91782 by Tom Apelt
Hi
After a small problem with the sturctured data in the module - I started to add some structured data to the the "improved.php" in
/modules/mod_eb_events/tmpl

so I made the following changes to the original one
1. Initialization - Line 64 changed:
Code:
<li class="vevent clearfix row-fluid">
to
Code:
<li class="clearfix row-fluid" itemscope itemtype="http://schema.org/Event">
! It is important that you remove the class "vevent" from this line (even if you don´t want to impement structured data) because it causes errors with microformat.org

2. Adding the Date - After Line 65 i put
Code:
<meta itemprop="startDate" content="<?php echo JFactory::getDate($row->event_date)->format("Y-m-d\TH:i"); ?>">
actually i just copied this line from the timeline view an changed the getdate() ;)

3. Adding URL: Changed line 86 from:
Code:
<a class="url eb-event-link" href="<?php echo JRoute::_(EventbookingHelperRoute::getEventRoute($row->id, 0, $itemId), false); ?>">
to
Code:
<a class="url eb-event-link" href="<?php echo JRoute::_(EventbookingHelperRoute::getEventRoute($row->id, 0, $itemId), false); ?>" itemprop="url">

4. Adding Name - Line 95 from:
Code:
<strong class="summary"><?php echo $row->title ; ?></strong>
to
Code:
<strong class="summary" itemprop="name"><?php echo $row->title ; ?></strong>

5. Adding location - and here i have still a little problem - so I added (copy paste from the timeline.php)
Code:
<div style="display:none" itemprop="location" itemscope itemtype="http://schema.org/Place"> <div itemprop="name"><?php echo $row->location_name ; ?></div> <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <span itemprop="streetAddress"><?php echo $location->address; ?></span> <?php if ($location->city && $location->state && $location->zip) { ?> <span itemprop="addressLocality"><?php echo $location->city; ?></span>, <span itemprop="addressRegion"><?php echo $location->state; ?></span> <span itemprop="postalCode"><?php echo $location->zip; ?></span> <span itemprop="addressCountry"><?php echo $location->country; ?></span> <?php } ?> </div>
So i think this is a a very quick and dirty method - I am not very familiar with php. So has anybody a more elegant way with the address?
The other problem is, that it just show in the structured data test:
location
@type Place
name BLABLA
address
@type PostalAddress
so no street address/locality country etc, - So I guess I miss something... Can you help me with that? I attached my improved.php as zip-file.

So in general it is working - an Events are shown in the google search results -but i am not sure how relevant the missing address details are...
Last edit: 9 years 10 months ago by Tom Apelt.

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

Moderators: Tuan Pham Ngoc