What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

53
#SMX #21A2 @gimpslice What To Do When Google Can't Understand Your JavaScript

Transcript of What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

Page 1: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

What To Do When Google Can't

Understand Your JavaScript

Althoughthisisatemplate,theseslideshavebeencreatedasexamplestoshowyouwhat’spossiblewithinthetemplate.PLEASEDELETEALLEXAMPLESLIDESANDNOTESBEFORECREATINGORIMPORTINGYOUROWNDECK. YOU MUST USE THE SMX FOOTER ON YOUR TITLE SLIDE! Thetemplateworksbestifyouuseittocreateapresentationfromscratch.However,thisblanklayoutoffersyouflexibilitytoinsertyourownslidesabovetheSMXfooter.Youmustusethisfooteratonalmostallofyourslides.Ifascreenshotoverlapsthefooteronoccasion,that’sfine–butdoyourbesttocropappropriately!Beforeyoudoanythingelse,replace“#XXa”inthefooterwithyoursession’sspecifichashtag.InPowerPoint,SelectVIEW>SLIDEMASTERtoeditandincludeitonallslidesofyourpresentation.Alsoaddyour@twitterhandle(or@companyhandleifyouprefer).Askyoursessioncoordinatorforthesession’sspecifichashtag!Thistemplateishigh-resolution16:9.DONOTchangeitto4:3.Alsonotethatifyouimporta4:3presentationinto16:9youmayencounterdisplayissues.ThetemplateusesCenturyGothic&Corbelasdefaultfonts.Arialisasecondaryfontthatmayappear.NotethatolderversionsofPowerPointmaynothavetheseasanoption;changetoArialorotherstandardsans-serif-font.Wheninsertingtext,you*MUST*useonlystandardfonts.Wecannotguaranteeeventlaptopswillhavespecialtyfontsinstalled,norcanwedosoonsite.Powerpointswithanimationsmaynottranslatewelltopdf/slideshareformat–youmayalsosubmita2ndversion/scrubbeddeckmoreappropriateforpostingonlinebySMXproductionstaff.

Example Title Slide:

Althoughthisisatemplate,theseslideshavebeencreatedasexamplestoshowyouwhat’spossiblewithinthetemplate.PLEASEDELETEALLEXAMPLESLIDESANDNOTESBEFORECREATINGORIMPORTINGYOUROWNDECK. YOU MUST USE THE SMX FOOTER ON YOUR TITLE SLIDE! Thetemplateworksbestifyouuseittocreateapresentationfromscratch.However,thisblanklayoutoffersyouflexibilitytoinsertyourownslidesabovetheSMXfooter.Youmustusethisfooteratonalmostallofyourslides.Ifascreenshotoverlapsthefooteronoccasion,that’sfine–butdoyourbesttocropappropriately!Beforeyoudoanythingelse,here’showtoreplace“#XXa”inthefooterwithyoursession’sspecifichashtag.InPowerPoint,SelectVIEW>SLIDEMASTERtoeditSLIDE#1toincludeitonallslidesofyourpresentation.Alsoaddyour@twitterhandle(or@companyhandleifyouprefer).Askyoursessioncoordinatorforthesession’sspecifichashtag!Thistemplateishigh-resolution16:9.DONOTchangeitto4:3.Alsonotethatifyouimporta4:3presentationinto16:9youmayencounterdisplayissues.ThetemplateusesCenturyGothic&Corbelasdefaultfonts.Arialisasecondaryfontthatmayappear.NotethatolderversionsofPowerPointmaynothavetheseasanoption;changetoArialorotherstandardsans-serif-font.Wheninsertingtext,you*MUST*useonlystandardfonts.Wecannotguaranteeeventlaptopswillhavespecialtyfontsinstalled,norcanwedosoonsite.Powerpointswithanimationsmaynottranslatewelltopdf/slideshareformat–youmayalsosubmita2ndversion/scrubbeddeckmoreappropriateforpostingonlinebySMXproductionstaff.

Page 2: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

JodyJ.O’DonnellSEOTechnicalDirectorMerkle,Inc

Page 3: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

WebsitesneedtobeDiscoverableandCrawlableWebpagesneedtobeunderstoodthroughSEOsignalsWebpagesneedtheirContenttobeScoredcorrectlytobeIndexedWebsitesneedtobeIndexedproperlytoRank

Let’s Start with the Basics

Page 4: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

WearenotgoingtotalkaboutBingexceptinthetraditionalsenseofreadingtheHTTPHeadersandtheHTMLSourceBingandtheothersearchenginesstillrequireHTMLsnapshots:§ HTMLSnapshotsandtherenderedDOMbyanormalbrowserengine(readbyGoogle)shouldbeidentical

Oh…Bing.

Page 5: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

FirstthingyoudidwasturnJSoffinnewbrowsersJavaScriptwasn’ttheproblem,butittooktheblame.Lookin’atyouMSIE3-6

The Browser Wars

Page 6: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Itwasn’tthatJavaScriptgotbetter§ Microsoftdecidedtoplayball§ InternetExplorergotbetterToday,JavaScriptisoneofthemostpopularprogramminglanguagesintheworld

So…What Happened?

Page 7: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

jQueryandMootoolscameoutinlessthanayearofeachotherOutoftheboxsolutionsforfree!Client-SideApplicationsthatusetraditionHTMLandCSSstatements

JavaScript Libraries

Page 8: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Developmentismuchfasterwhenyoureferenceafreelibraryratherthancreateiteachtime§ Browsercompatibilitywasabiggerdeal,too

ItworkedwithSEO!

What did this do for Us?

Page 9: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

SEOAin’tAllThat§ Userexperienceismoreimportantthanever

§ Attentionspansareshort§ Wecan'tholdtechnologyhostagebecauseofSEO

At the End of the Day

Page 10: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

LibrariesEvolvedtoentireframeworksFrameworkswereoutoftheboxsolutionsforcreatingapps§ Appscanbeonclientorserver§ TheframeworkscreatedoutoftheboxMVC’s

Programmersarenowfreetoconcentrateonfunctionality

JavaScript Frameworks

Page 11: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

FromanSEOstandpoint,welookattheresult§ Ourexaminationisinthecode,notthebackendtoproduceit

Wearenotgoingtodiscussthedifferencesbetweentheframeworks§ Northeclient-sidevs.server-siderendering§ SPA’sandframeworksshouldbeabletoproduce1URLtoonepieceofuniquecontent

SPA’s and JavaScript Frameworks

Page 12: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Page 13: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

TheybuiltahistoryAPIcallbetweentheCodeandthebrowserSpecifically,afunctioncalledpushState()Twoofthosevariables§  TitleTag§ URL

History API - pushState()

Page 14: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Page 15: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

SEO’sneedtounderstandthedifferencebetween:

§ HTTPHeaders§ HTMLSource

§ HTMLSnapshot

§ RenderedDOM

Different Places to Look

Page 16: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Allsearchengineshavetwoorders§ HTTPHeaders–  x-robots-tag,link:canonical,link:hreflang

§ HTMLSource– metarobotstag,<link>canonical,<link>hreflang

SEO Signals by Order of Precedence

Page 17: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

DOM – The Third Order

Page 18: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

JavaScriptredirectsaretreatedinasimilarmanneras301redirects

What were the Results?

Page 19: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

DynamicallyinsertedcontentistreatedinanequivalentwhetherintheHTMLsourceorintheDOM.§ ThisgoeswithSEOSignalsaswell

What were the Results?

Page 20: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Oneoftheteststhatfailed§ Therel=“nofollow”tagwascompletelyignoredintheDOM

WethinkthisisanOrderofPrecedenceproblem§ CrawlsignalsarepickedupstartingintheHTMLsource,lookingfortherel=”nofollow”signal

§ Essentially,adedupingmechanismmayberesponsible

One Discrepancy

Page 21: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

SEOSignal:§ wewillpickitupanduseitthefirsttimeweseeit

Content:§ Moreofamixedbag,theycouldchoosewhichcontenttheyscoreandindex

SEO Signal vs. Content

Page 22: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Asasecondaryeffect,ourarticlegotpickedupinahackernewsthreadThesinglepiecethatcamefromthiswholediscussionwasasmallpartwithaself-purportedEx-GoogleEmployee§ Discussionaboutifgooglewouldwaitfor120secondsbeforetakingthesnapshotincaseofinjectedcontent

§ Googleengineerdidagreethattheydidanditwasafixedtime

Wasittrue?

Hackernews

Page 23: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Google Fetch & Render PageSpeed Insights

www.maxxeight.com/js-timer/

Page 24: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

MostEcomsiteshavecategorypageswithhundredsofproductstolist

The Category Page Conundrum

Page 25: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Youhadthreechoices:§ View-AllPages§ PaginatedPages§ LazyLoading(whichdidn’thaveanSEOoption)

The Category Page Conundrum

Page 26: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

InfinitescrollchangedwithHTML5’sHistoryAPINowwecantieaJSListeningHandlerwithapushState()call§ Youcanpush{{URL+?page=2}}intotheURLbar–  REMEMBER:Youcanupdatetitletaghere,too

Infinite Scroll + HTML5

Page 27: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

SearchenginescanreferenceanyoftheindividualpagesandrendertheHTMLequivalentofthatsinglepage

§  THISISWHATYOUDOWITHPAGINATIONALREADY!!!

Infinite Scroll + HTML5

Page 28: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

TheuserscrollsasfarastheywantFantasticUserExperience

Infinite Scroll + HTML5

Page 29: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

ThereisaproblemWestillneedlinks!

Partial Solution

Page 30: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Page 31: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

TherenderedHTMLversionoftheDOMshouldbeaworkingHTMLcopyofthepage§ Whenyou“InspectElement”youareseeingthevisualrepresentationoftheDOM

The Rendered DOM

Page 32: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

HTMLSnapshotsshouldbeasclosetoanexactHTMLinstanceoftheDOMaspossibleGooglebotdoesnotneedtheseatthistime

Let’s Talk Snapshots

Page 33: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

DonothaveconflictingsignalsbetweentheOrdersofPrecedence

§ BeconsistentbetweentheHTTPHeaders,HTMLSourceandrenderedDOM

Conflicting SEO Signals

Page 34: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

InorderfortheDOMtofullyrendercorrectly,thebrowserneedsaccesstoalltheassetsbeingrequestedforthepageThisistrueforgooglebottorendertheDOM,too§ Ifgooglebotcan’taccessassetslikeJavaScript,pagerenderscanbeincomplete

Crawl Signals – Robots.txt

Page 35: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Crawlsignalscanbepickedupanywhereinthe:§ HTTPHeaders(canonicals)§ HTMLSource(links)§ DOM(links)

CrawlsignalsshouldbeconsistentbetweentheOrdersofPrecedence§ Conflicting,orsignalsthatonlyappearonlyintheDOM(suchastherel=“nofollow”)mightnotbeseenorinterpretedcorrectly

Crawl Signals

Page 36: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

ThewebisstillbasedonlinksAJSfunctionisnotahyperlinkelement§ WehaveseenGoogleincorrectlycreateURL“strings”andgenerateURLsthatdon’texist

Onclick + window.location != <a href=”#”>

Page 37: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

NavigationstillneedstobelinksthatgotothecorrectpageSamewithFacetedNavigation§ Eachfacetlinkneedstocorrespondtoanactualpageintheclick+reloadmethod

§ TheactualloadingcanbeAJAXcallsfortheuser

Crawl Signals - Navigation

Page 38: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

GooglebotisalameuserGooglebotdoesn’tclickonbuttonsanddoesn’tscrolldownthepage,etc§ ThereforethecontentneedstobeloadedintheDOMautomatically,notbasedonuserinteractions

§ Wehaven'tseenAJAXsequencesbeingindexedandinterpretedbyGooglebot.

Content Considerations

Page 39: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

1URLperpieceofcontentand1pieceofcontentperURL–§ ItisessentialtohaveeverypieceofcontentaccessibleviaitsownURL

§ SinglePageApplications(SPAs)shouldactuallynotbeusinga“singlepage”orsingleURLwhendeliveringthecontent

Changing Content Best Practices

Page 40: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

TabbedcontentshouldallbeintheDOM§ SamewaywewouldwantitifweweretalkingaboutputtingitintheHTMLsourcetobeginwith

Changing Content

Page 41: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

BecauseoftheDOMSnapshot(5seconds)§ Contentinjectedautomaticallyafter5secondswon’tbescoredorindexed

§ SEOsignalsafter5secondswon’tbeincludedinthescoring

§ HTMLSnapshotsneedtoalignherewiththecontentwithinthat5secondcutoff

Content - DOM Timeouts

Page 42: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Reviewsonpagesaregenerallylikeoldlazyloadpages§ ThefirstgroupingisloadedintheDOM

§ TherestareAJAXcalls§ ReviewsbehindtheAJAXcallswillmostlikelystillnotbeindexed

Content - Reviews

Page 43: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Indexationsignaldirectivesshouldbealignedaswell§ X-Robots-TagandMetaRobots“noindex”§ JavaScriptRedirects

Indexationsignalhints§ Relnext/prevconsolidationsignals§ LinkCanonicaltags§ LinkAlternatetags

Index Signals

Page 44: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Page 45: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

SPA’s and Status Codes

Page 46: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

SPA’s and Status Codes

Page 47: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

IfURLdoesn’texist->§ JSredirecttoapagethatactually404§ DonotuseMeta-EquivRefreshtoredirect

Ifyouneedtoredirect:–  302–ItneedstobeserversidebeforebeforetheJSapploads(rewriterule)

–  301-sameas302orJSredirect(consideredas301byGoogle)

Status Code Challenges

Page 48: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Page 49: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

HTTPHeaders,HTMLSource,HTMLSnapshotsandtheDOMallcontainSEOsignals§ GoogleislookingatallthreeOrdersofPrecedenceforsignals§ Bing/Restofworldlookatitthroughthetraditionaltwoorders§ BeconsistentinyourcontentandSEOsignals

A Signal is a Signal is a Signal

Page 50: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

GoogleisdumpingtheDOM§ LineupcontentandSEOsignalatalllevelsofprecedence§ TheDOMshouldbeanHTMLrepresentationoftheworkingpage§ LookatyourpagesinFetchandRendertoseehowGoogleisabletorenderthepage

Googlebot only as Good as the DOM

Page 51: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

Googlebotcan’trenderdynamiccontentdrivenbyuserinteractionssuchasclickandmouseover§ Itisn’tauser,itisn’tgoingtointeractwiththepagebeyondalinkorapost§ Itwon’t“scr0ll”tothebottomofthepage§ YouneedtoassignauniqueURLtoeachpieceofuniquecontent

Googlebot is a Lame User

Page 52: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

WeTestedJavaScript!§ http://searchengineland.com/tested-googlebot-crawls-javascript-heres-learned-220157

HacknewsThread§ https://news.ycombinator.com/item?id=9529782

AngularAirHangout§ https://www.youtube.com/watch?v=lxulee01zyY

Links to articles referenced

Page 53: What To Do When Google Can't Understand Your JavaScript By Jody O'Donnell

#SMX #21A2 @gimpslice

LEARN MORE: UPCOMING @SMX EVENTS

THANK YOU! SEE YOU AT THE NEXT #SMX