HTML5 History api to Ajaxify your Magnolia Website

Post on 30-Nov-2014

1.217 views 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 of HTML5 History api to Ajaxify your Magnolia Website

Wednesday, September 5, 12

Know Your History(API)

Using HTML5 History API to Ajaxify your Magnolia WebSite

Wednesday, September 5, 12

• 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

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

California, USA• wpaoli@atlassian.com

About Me

Wednesday, September 5, 12

How we work together

Interactive Marketing TeamDesigners and Web Developers

Wednesday, September 5, 12

How we work together

Interactive Marketing TeamDesigners and Web Developers

Product Marketing Managers

Wednesday, September 5, 12

How we work together

Interactive Marketing TeamDesigners and Web Developers

Product Marketing Managers Demand Generation

Wednesday, September 5, 12

The Website is our Salesperson

Wednesday, September 5, 12

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

The Atlassian Redesign

August 2012

Wednesday, September 5, 12

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

The Atlassian Redesign

1,800,000 Visits

Wednesday, September 5, 12

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

The Atlassian Redesign

4,006,000 Pageviews

Wednesday, September 5, 12

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

The Atlassian Redesign

Wednesday, September 5, 12

The Big Redesign

Wednesday, September 5, 12

• SEO • Clean URLS• Clean UI• Great Performance

The Concerns

Wednesday, September 5, 12

• SEO • Clean URLS• Clean UI• Great Performance

The Concerns

Wednesday, September 5, 12

The Conversation

Wednesday, September 5, 12

Wednesday, September 5, 12

Wednesday, September 5, 12

Wednesday, September 5, 12

Wednesday, September 5, 12

Wednesday, September 5, 12

Wednesday, September 5, 12

Wednesday, September 5, 12

Wednesday, September 5, 12

Wednesday, September 5, 12

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

“DUDE, you

are using

the

HISTORY

API Right?”Wednesday, September 5, 12

Of course I am, duh...

Wednesday, September 5, 12

Of course I am, duh...

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

Wednesday, September 5, 12

Wednesday, September 5, 12

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

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

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

history.pushState(data,title,url)

Wednesday, September 5, 12

history.pushState(data,title,url)

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

Wednesday, September 5, 12

history.pushState(data,title,url)

{tabName:‘foo’}

Currently Not Implemented

Wednesday, September 5, 12

history.pushState(data,title,url)

{tabName:‘foo’}

Used to modify window.location

Wednesday, September 5, 12

history.pushState(data,title,url)

{tabName:‘foo’}

AKA “Fake” URLS

Wednesday, September 5, 12

history.pushState(data,title,url);

history.replaceState(data,title,url);

Wednesday, September 5, 12

history.pushState(data,title,url);

history.replaceState(data,title,url);

window.onpopstate = function(){}

Wednesday, September 5, 12

A useless example that hopefully illustrates

how this works

Wednesday, September 5, 12

Level 1

Old Skool Style

Wednesday, September 5, 12

Demo of static tabs (reload each time)

Wednesday, September 5, 12

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

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

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

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

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

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

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

Level 2Get Some jQuery up in there!

Wednesday, September 5, 12

JS tab solution

Wednesday, September 5, 12

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

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

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

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

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

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

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

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

Wednesday, September 5, 12

History API to the Rescue

history.pushState(data,title, url)

Wednesday, September 5, 12

History API’d tab solution

Wednesday, September 5, 12

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

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

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

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

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

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

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

Level 4Put it all together!

Wednesday, September 5, 12

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

Wednesday, September 5, 12

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

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

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

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

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

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

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

Dude, um did you forget IE again?!

Wednesday, September 5, 12

There’s a plugin for that

Wednesday, September 5, 12

• 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

Whose Happy?

Wednesday, September 5, 12

Whose Happy?

Jeff the Designer is Happy!

Wednesday, September 5, 12

Whose Happy?

Jeff the Designer is Happy!

Mr “SEO” Joe is happy!

Wednesday, September 5, 12

Whose Happy?

Jeff the Designer is Happy!

Mr “SEO” Joe is happy!

The Users of atlassian.com are Happy!

Wednesday, September 5, 12

Thanks for listening!

Wednesday, September 5, 12

Questions?

Wednesday, September 5, 12

Be sure to check out:Continuous Media Playback and

RequireJS ModulesDavid Pronk

David Pronk

Wednesday, September 5, 12