html5 history api to ajaxify your magnolia website

88
Wednesday, September 5, 12

Upload: boris-kraft

Post on 30-Nov-2014

1.215 views

Category:

Technology


0 download

DESCRIPTION

"Know your History! Use the HTML5 History api to Ajaxify your Magnolia site without sacrificing SEO or Usability." Using the history api, jQuery and Magnolia, learn how to create websites that are highly responsive, search engine friendly, have pretty urls, and don't break the back button. Using this technique we make everyone happy, from content publishers, to search engines and most importantly the end user.

TRANSCRIPT

Page 1: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 2: HTML5 History api to Ajaxify your Magnolia Website

Know Your History(API)

Using HTML5 History API to Ajaxify your Magnolia WebSite

Wednesday, September 5, 12

Page 3: HTML5 History api to Ajaxify your Magnolia Website

• The story of when I realized I needed to learn more about the history API

• A stupidly simple example of the code in action• A walkthrough of our product tour redesign• How it works with magnolia

Agenda

Wednesday, September 5, 12

Page 4: HTML5 History api to Ajaxify your Magnolia Website

• William Paoli• Front End Web Developer• From San Francisco,

California, USA• [email protected]

About Me

Wednesday, September 5, 12

Page 5: HTML5 History api to Ajaxify your Magnolia Website

How we work together

Interactive Marketing TeamDesigners and Web Developers

Wednesday, September 5, 12

Page 6: HTML5 History api to Ajaxify your Magnolia Website

How we work together

Interactive Marketing TeamDesigners and Web Developers

Product Marketing Managers

Wednesday, September 5, 12

Page 7: HTML5 History api to Ajaxify your Magnolia Website

How we work together

Interactive Marketing TeamDesigners and Web Developers

Product Marketing Managers Demand Generation

Wednesday, September 5, 12

Page 8: HTML5 History api to Ajaxify your Magnolia Website

The Website is our Salesperson

Wednesday, September 5, 12

Page 9: HTML5 History api to Ajaxify your Magnolia Website

We wanted to go from “This” to “This"

The Atlassian Redesign

August 2012

Wednesday, September 5, 12

Page 10: HTML5 History api to Ajaxify your Magnolia Website

We wanted to go from “This” to “This"

The Atlassian Redesign

1,800,000 Visits

Wednesday, September 5, 12

Page 11: HTML5 History api to Ajaxify your Magnolia Website

We wanted to go from “This” to “This"

The Atlassian Redesign

4,006,000 Pageviews

Wednesday, September 5, 12

Page 12: HTML5 History api to Ajaxify your Magnolia Website

We wanted to go from “This” to “This"

The Atlassian Redesign

Wednesday, September 5, 12

Page 13: HTML5 History api to Ajaxify your Magnolia Website

The Big Redesign

Wednesday, September 5, 12

Page 14: HTML5 History api to Ajaxify your Magnolia Website

• SEO • Clean URLS• Clean UI• Great Performance

The Concerns

Wednesday, September 5, 12

Page 15: HTML5 History api to Ajaxify your Magnolia Website

• SEO • Clean URLS• Clean UI• Great Performance

The Concerns

Wednesday, September 5, 12

Page 16: HTML5 History api to Ajaxify your Magnolia Website

The Conversation

Wednesday, September 5, 12

Page 17: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 18: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 19: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 20: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 21: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 22: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 23: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 24: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 25: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 26: HTML5 History api to Ajaxify your Magnolia Website

Requirements of New Product Tour

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 27: HTML5 History api to Ajaxify your Magnolia Website

“DUDE, you

are using

the

HISTORY

API Right?”Wednesday, September 5, 12

Page 28: HTML5 History api to Ajaxify your Magnolia Website

Of course I am, duh...

Wednesday, September 5, 12

Page 29: HTML5 History api to Ajaxify your Magnolia Website

Of course I am, duh...

So uh...what’s the History API?

Wednesday, September 5, 12

Page 30: HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Page 31: HTML5 History api to Ajaxify your Magnolia Website

window.history.length - returns the number of items

window.history.go(n)- go forward/backward any number

window.history.back()- go back

window.history.forward()- go forward

window.history.pushState(data, title, url)

window.history.replaceState(data, title, url)

Wednesday, September 5, 12

Page 32: HTML5 History api to Ajaxify your Magnolia Website

window.history.length - returns the number of items

window.history.go(n)- go forward/backward any number

window.history.back()- go back

window.history.forward()- go forward

window.history.pushState(data, title, url)

window.history.replaceState(data, title, url)

Wednesday, September 5, 12

Page 33: HTML5 History api to Ajaxify your Magnolia Website

window.history.length - returns the number of items

window.history.go(n)- go forward/backward any number

window.history.back()- go back

window.history.forward()- go forward

window.history.pushState(data, title, url)

window.history.replaceState(data, title, url)

Wednesday, September 5, 12

Page 34: HTML5 History api to Ajaxify your Magnolia Website

history.pushState(data,title,url)

Wednesday, September 5, 12

Page 35: HTML5 History api to Ajaxify your Magnolia Website

history.pushState(data,title,url)

{tabName:‘foo’}Adds to history.state

Wednesday, September 5, 12

Page 36: HTML5 History api to Ajaxify your Magnolia Website

history.pushState(data,title,url)

{tabName:‘foo’}

Currently Not Implemented

Wednesday, September 5, 12

Page 37: HTML5 History api to Ajaxify your Magnolia Website

history.pushState(data,title,url)

{tabName:‘foo’}

Used to modify window.location

Wednesday, September 5, 12

Page 38: HTML5 History api to Ajaxify your Magnolia Website

history.pushState(data,title,url)

{tabName:‘foo’}

AKA “Fake” URLS

Wednesday, September 5, 12

Page 39: HTML5 History api to Ajaxify your Magnolia Website

history.pushState(data,title,url);

history.replaceState(data,title,url);

Wednesday, September 5, 12

Page 40: HTML5 History api to Ajaxify your Magnolia Website

history.pushState(data,title,url);

history.replaceState(data,title,url);

window.onpopstate = function(){}

Wednesday, September 5, 12

Page 41: HTML5 History api to Ajaxify your Magnolia Website

A useless example that hopefully illustrates

how this works

Wednesday, September 5, 12

Page 42: HTML5 History api to Ajaxify your Magnolia Website

Level 1

Old Skool Style

Wednesday, September 5, 12

Page 43: HTML5 History api to Ajaxify your Magnolia Website

Demo of static tabs (reload each time)

Wednesday, September 5, 12

Page 44: HTML5 History api to Ajaxify your Magnolia Website

Static Site Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 45: HTML5 History api to Ajaxify your Magnolia Website

Static Site Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 46: HTML5 History api to Ajaxify your Magnolia Website

Static Site Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 47: HTML5 History api to Ajaxify your Magnolia Website

Static Site Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 48: HTML5 History api to Ajaxify your Magnolia Website

Static Site Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 49: HTML5 History api to Ajaxify your Magnolia Website

Static Site Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 50: HTML5 History api to Ajaxify your Magnolia Website

Static Site Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 51: HTML5 History api to Ajaxify your Magnolia Website

Level 2Get Some jQuery up in there!

Wednesday, September 5, 12

Page 52: HTML5 History api to Ajaxify your Magnolia Website

JS tab solution

Wednesday, September 5, 12

Page 53: HTML5 History api to Ajaxify your Magnolia Website

JS Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 54: HTML5 History api to Ajaxify your Magnolia Website

JS Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 55: HTML5 History api to Ajaxify your Magnolia Website

JS Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 56: HTML5 History api to Ajaxify your Magnolia Website

JS Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 57: HTML5 History api to Ajaxify your Magnolia Website

JS Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 58: HTML5 History api to Ajaxify your Magnolia Website

JS Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 59: HTML5 History api to Ajaxify your Magnolia Website

JS Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 60: HTML5 History api to Ajaxify your Magnolia Website

Level 3Let’s add that History thing William keeps talking about

Wednesday, September 5, 12

Page 61: HTML5 History api to Ajaxify your Magnolia Website

History API to the Rescue

history.pushState(data,title, url)

Wednesday, September 5, 12

Page 62: HTML5 History api to Ajaxify your Magnolia Website

History API’d tab solution

Wednesday, September 5, 12

Page 63: HTML5 History api to Ajaxify your Magnolia Website

History API’d Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 64: HTML5 History api to Ajaxify your Magnolia Website

History API’d Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 65: HTML5 History api to Ajaxify your Magnolia Website

History API’d Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 66: HTML5 History api to Ajaxify your Magnolia Website

History API’d Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 67: HTML5 History api to Ajaxify your Magnolia Website

History API’d Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 68: HTML5 History api to Ajaxify your Magnolia Website

History API’d Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 69: HTML5 History api to Ajaxify your Magnolia Website

History API’d Tab Report Card

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 70: HTML5 History api to Ajaxify your Magnolia Website

Level 4Put it all together!

Wednesday, September 5, 12

Page 71: HTML5 History api to Ajaxify your Magnolia Website

History API’d tab + Static Pages behind the fake urls solution

Wednesday, September 5, 12

Page 72: HTML5 History api to Ajaxify your Magnolia Website

History API Tab with Static Behnd

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 73: HTML5 History api to Ajaxify your Magnolia Website

History API Tab with Static Behnd

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 74: HTML5 History api to Ajaxify your Magnolia Website

History API Tab with Static Behnd

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 75: HTML5 History api to Ajaxify your Magnolia Website

History API Tab with Static Behnd

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 76: HTML5 History api to Ajaxify your Magnolia Website

History API Tab with Static Behnd

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 77: HTML5 History api to Ajaxify your Magnolia Website

History API Tab with Static Behnd

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 78: HTML5 History api to Ajaxify your Magnolia Website

History API Tab with Static Behnd

Easy to Read and Real URLs

Search Engine Friendly/Discoverability

Don’t Break Back Button

Unique page titles for each tab

Unique Description and Keywords available

Great User Experience

Wednesday, September 5, 12

Page 79: HTML5 History api to Ajaxify your Magnolia Website

Dude, um did you forget IE again?!

Wednesday, September 5, 12

Page 80: HTML5 History api to Ajaxify your Magnolia Website

There’s a plugin for that

Wednesday, September 5, 12

Page 81: HTML5 History api to Ajaxify your Magnolia Website

• HTML5 History api is very valuable• We can now create ajax pages that have clean urls and

is able to be search engine optimised• We made people happy!

Main Points to this

Wednesday, September 5, 12

Page 82: HTML5 History api to Ajaxify your Magnolia Website

Whose Happy?

Wednesday, September 5, 12

Page 83: HTML5 History api to Ajaxify your Magnolia Website

Whose Happy?

Jeff the Designer is Happy!

Wednesday, September 5, 12

Page 84: HTML5 History api to Ajaxify your Magnolia Website

Whose Happy?

Jeff the Designer is Happy!

Mr “SEO” Joe is happy!

Wednesday, September 5, 12

Page 85: HTML5 History api to Ajaxify your Magnolia Website

Whose Happy?

Jeff the Designer is Happy!

Mr “SEO” Joe is happy!

The Users of atlassian.com are Happy!

Wednesday, September 5, 12

Page 86: HTML5 History api to Ajaxify your Magnolia Website

Thanks for listening!

Wednesday, September 5, 12

Page 87: HTML5 History api to Ajaxify your Magnolia Website

Questions?

Wednesday, September 5, 12

Page 88: HTML5 History api to Ajaxify your Magnolia Website

Be sure to check out:Continuous Media Playback and

RequireJS ModulesDavid Pronk

David Pronk

Wednesday, September 5, 12