MicroData - schema.org

Everything related to GBook PHP guestbook
Post Reply
SimonA
Posts: 3
Joined: Mon Apr 15, 2013 3:30 pm

MicroData - schema.org

Post by SimonA »

Hi,

GBook is such an easy script to set up that it occurred to me that it could be used to collect reviews that have microdata/Rich Snippets markup in them - definitely a great way of getting better listings in the search engines.

I've done the markup already; relatively simple because all it needed was a few template changes: a change to overall_header.php and comments.php.

What I haven't done is put star ratings and aggregate ratings in because the scripting is beyond me; if anyone would care to assist with that please get in touch.

It's still a work in progress but I'm happy to share what I've done so far:

/*************************************
Title: MicroData
Version: 0.01
Author: Simon Allen
Demo: http://www.1-ecommerce.com/comments/gbook.php
Download: None Yet


Description:
Amendments to the files as follows:

\gbook\templates\default\overall_header.php
Amend DTD on Line 4 to:

Code: Select all

<!DOCTYPE html>
\gbook\templates\default\comments.php
Amend line 5 and add a new line to look like this:

Code: Select all

<div class="gbook_commentbox" itemprop="review" itemscope="" itemtype="http://schema.org/Review">
	<meta itemprop="itemReviewed" content="Add Your Review Title" />
Replace line 10 and add a new line to look like this:

Code: Select all

<span class="gbook_submitted_by"><?php echo $lang['t17']; ?> <b><?php echo $name; ?></b>
    <meta itemprop="author" content="<?php echo $name; ?>"/></b></span><br class="clear" />
The original line 14, which is probably now line 15 should be replaced with the following three lines:

Code: Select all

echo '<span class="gbook_submitted_by">'.$lang['t18'].' '.$from.'</span>';
		echo '<meta itemprop="name" content="'.$from.'" />';
		echo '<br class="clear"/>';
The original line 34 should now be on line 42 and be replaced with:

Code: Select all

<span class="gbook_added"><meta itemprop="datePublished" content="<?php echo $added; ?>" /><i><?php echo $lang['t31'].' '.$added; ?></i></span>
*************************************/

Once you've done all that go to the Google Rich Snippets Testing tool http://www.google.com/webmasters/tools/richsnippets and test your page.

Heres the URL for my own: http://www.google.com/webmasters/tools/ ... .php&html=

You can miss out the "itemReviewed" line if you wish and I've added a CreativeWork - WebPage declaration by altering the body tag as follows:

Code: Select all

<body itemscope itemtype="http://schema.org/WebPage">
For more information on Rich Snippets, MicroData and Structured Markup see http://schema.org

Cheers

Simon
Klemen
Site Admin
Posts: 10114
Joined: Fri Feb 11, 2005 4:04 pm

Re: MicroData - schema.org

Post by Klemen »

Thanks for sharing. To be honest, I never used microdata nor was I aware of it.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
SimonA
Posts: 3
Joined: Mon Apr 15, 2013 3:30 pm

Re: MicroData - schema.org

Post by SimonA »

Hi Klemen,

MicroData has been around for a while, initially in RDFa formatting, but it wasn't until 2011 that the major search engines got together to standardise it - that's when schema.org was launched.

It would also be possible to add Facebook's Social Graph Protocol markup in too.

I've been thinking about going through the same process of putting the markup into the comments on Hesk - I'll post the add-on in the relevant forum when I get it done.

I may also see if the star rating system you have in Hesk could be added to GBook, although how it could be done without the db is something I'll need to think hard about.

Cheers

Simon
Post Reply