Transcript
Page 1: Hacking the Google Snippet - Digpen 7 workshop

HACK ING THE GOOGLE SN IPPET2 6 T H S E P T E M B E R 2 0 1 4

Ian MacfarlaneHead of Technical Search

[email protected]://ianmacfarlane.com

Page 2: Hacking the Google Snippet - Digpen 7 workshop

What we’ll cover today

• Introduction to Rich Snippets & microdata

• Exercise – breadcrumb trail (5 mins)

• Nesting microdata

• Exercise – nested microdata (10 - 15 mins)

• Introduction to JSON-LD

• Exercise – JSON-LD (10 - 15 mins)

• Wrapping up

Page 3: Hacking the Google Snippet - Digpen 7 workshop

A standard Google snippetTitle

URL

Snippet

Page 4: Hacking the Google Snippet - Digpen 7 workshop

A modern Google snippet

Review

Breadcrumb trail

Price

Stock availability

Page 5: Hacking the Google Snippet - Digpen 7 workshop

Why care about this?

Page 6: Hacking the Google Snippet - Digpen 7 workshop

How does it increase traffic?

• Rich Snippets catch people’s attention

• 15%-30% traffic uplift not uncommon

• That’s without any increase in rankings

Page 7: Hacking the Google Snippet - Digpen 7 workshop

Appear in new places

Page 8: Hacking the Google Snippet - Digpen 7 workshop

… or maybe

(if you’re anything like me)

you just enjoying playing around with shiny new code

Page 9: Hacking the Google Snippet - Digpen 7 workshop

Creating Rich Snippets

Page 10: Hacking the Google Snippet - Digpen 7 workshop

How to create Rich Snippets

• It’s simple

• Just add a little bit of extra code to your web pages

• Tells search engines what the content is about

Page 11: Hacking the Google Snippet - Digpen 7 workshop

Which format?

data-vocabulary.org

MICRODATA

Page 12: Hacking the Google Snippet - Digpen 7 workshop

Yep, pretty much this…

Page 13: Hacking the Google Snippet - Digpen 7 workshop

What data types does Google support?

• Apps• Articles• Authors• Business phone

number• Breadcrumbs• Events• Local business*• Organisation logo• People

• Products

• Publisher (link to G+)

• Recipes

• Review

• Reviews

• Site search

• Videos

Page 14: Hacking the Google Snippet - Digpen 7 workshop

What does microdata look like?

Page 15: Hacking the Google Snippet - Digpen 7 workshop

Here’s some HTML …

<div><h1>iPhone 6</h1><div>Latest overpriced shiny thing from Apple</div><img

src="http://www.apple.com/iphone6.png"></div>

Page 16: Hacking the Google Snippet - Digpen 7 workshop

Microdata is just adding some new properties

<div itemscope itemtype="http://schema.org/Product"><h1 itemprop="name">iPhone 6</h1><div itemprop="description">Latest overpriced shiny thing from Apple</div><img src="http://www.apple.com/iphone6.png"

itemprop="image"></div>

Page 17: Hacking the Google Snippet - Digpen 7 workshop

Three key attributes

• itemscope– Defines the scope of the object– All itemprop values inside this scope relate to the object

• itemtype– Defines the type of object, e.g. a Product or Review– Value is a URL e.g. http://schema.org/Product

Page 18: Hacking the Google Snippet - Digpen 7 workshop

Three key attributes

• itemprop– Defines a property of the item (e.g. name, price, etc.)– There are a variety of types in Schema.org

• Boolean• Date• Number• Text• Time

– A property can also be another Schema.org object(we’ll look at this a bit later)

Page 19: Hacking the Google Snippet - Digpen 7 workshop

Here’s that example again

<div itemscope itemtype="http://schema.org/Product"><h1 itemprop="name">iPhone 6</h1><div itemprop="description">Latest overpriced shiny thing from Apple</div><img src="http://www.apple.com/iphone6.png"

itemprop="image"></div>

Page 20: Hacking the Google Snippet - Digpen 7 workshop

Exercise #1 – let’s start off simple

Breadcrumb trail

Page 21: Hacking the Google Snippet - Digpen 7 workshop

Exercise 1

• Mark up a breadcrumb trail

• Link: http://goo.gl/JKRlPE

• Password: “devon”

Page 22: Hacking the Google Snippet - Digpen 7 workshop

Nesting objects

Page 23: Hacking the Google Snippet - Digpen 7 workshop

Nesting objects

• You can also nest one object inside another

• A nested object is a property of the parent object

Page 24: Hacking the Google Snippet - Digpen 7 workshop

Example of nesting

<div itemscope itemtype="http://schema.org/Event"><h1 itemprop="name">Digpen 2015</h1><div itemprop="description">The nicest little

web conference in the West</div><div itemprop="location" itemscope

itemtype="http://schema.org/City"><span itemprop="name">Plymouth</span>

</div></div>

Page 25: Hacking the Google Snippet - Digpen 7 workshop

You can nest multiple times

Hotel

AggregateRating (average review) PostalAddress

Country

Parent Organisation

PostalAddress

Country

Page 26: Hacking the Google Snippet - Digpen 7 workshop

Exercise #2 – getting more complex

Product with reviews

Page 27: Hacking the Google Snippet - Digpen 7 workshop

Exercise 2

• Product with reviews

• Link: http://goo.gl/IiRPdC

• Password: “devon”

Page 28: Hacking the Google Snippet - Digpen 7 workshop

Introducing JSON-LD

Page 29: Hacking the Google Snippet - Digpen 7 workshop

What is JSON-LD

• A format for linked data

• Uses JSON syntax – simple key:value pairs

• Instead of marking up existing on-page content, you embed it via a <script> tag

Page 30: Hacking the Google Snippet - Digpen 7 workshop

<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "Schema.org type goes here", "property name": "property value"}</script>

Simple JSON-LD

Watch out for trailing commas!

Page 31: Hacking the Google Snippet - Digpen 7 workshop

Simple JSON-LD

<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "Event", "name": "Digpen", "description": "The nicest little web conference in the West"}</script>

Page 32: Hacking the Google Snippet - Digpen 7 workshop

Nesting JSON-LD

<script type="application/ld+json">{

"@context": "http://schema.org","@type": "Event","name": "Digpen","description": "The nicest little web conference in the West","location": {

"@type": "City","name": "Plymouth"

}}</script>

Page 33: Hacking the Google Snippet - Digpen 7 workshop

Exercise #3 – trailing comma fun

JSON-LD

Page 34: Hacking the Google Snippet - Digpen 7 workshop

Exercise 3

• JSON-LD exercise

• Link: http://goo.gl/z64oRy

• Password: “devon”

Page 35: Hacking the Google Snippet - Digpen 7 workshop

Which format should I use?

Page 36: Hacking the Google Snippet - Digpen 7 workshop

Which format?

data-vocabulary.org

MICRODATA

Page 37: Hacking the Google Snippet - Digpen 7 workshop

Which format should I use?

• Microformats provide limited data

• Microformats 2 not supported by search engines

• RDFa usually ok if you use the Schema.org versions– However, industry moving towards newer formats

Page 38: Hacking the Google Snippet - Digpen 7 workshop

Which format should I use?

Use Schema.org…

… in one of these two formats

MICRODATA

Page 39: Hacking the Google Snippet - Digpen 7 workshop

Which format should I use?

• Microdata– Simpler to code – just add properties to existing HTML– Reduces code duplication (especially with large text

values)

• JSON-LD– Nesting is easier if item properties are all over the page– Less error prone to breaking with page layout tweaks

Page 40: Hacking the Google Snippet - Digpen 7 workshop

Exercise #4 – if we have time

Mark up your own site

Page 41: Hacking the Google Snippet - Digpen 7 workshop

Thank you

• Ian Macfarlane• [email protected]

Page 42: Hacking the Google Snippet - Digpen 7 workshop

Documentation

• Schema.org specification– The most important specification, supported by Google, Bing, Yahoo! & Yandex

• Google’s Rich Snippets documentation– Documentation including list of supported formats

• Google’s Rich Snippets Course List– More documentation and information on more supported formats e.g. sitelinks search

• Google’s customer service numbers specification– Documentation on how to specify your company’s phone numbers to Google

• Google Publisher Markup• Documentation on linking your Google+ profile to your website

Page 43: Hacking the Google Snippet - Digpen 7 workshop

Tools for testing

• Rich Snippets Testing Tool• Gives snippet preview

• Corporate Contacts Tester• Supports JSON-LD

• Google Webmaster Tools• Shows you all structured

data Google has found, including errors

• JSON-LD Playground• Live error checking as

you type

• Bing Markup Validator• Check in Bing

• Yandex data validator• Russian search engine


Top Related