SEO for Developers

509
-1

Published on

Slides from my talk at

Published in: Technology, Design
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
509
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

SEO for Developers

  1. 1. re al vSEO For DevelopersSELECT  *  WHERE  clue  >  0;Date: February 29, 2012Author: Chris Le (@djchrisle) 1
  2. 2. $  whoami {  name:                “Chris  Le”,    twitter:          “@DjChrisLe”,    occupation:  [        “Internal  app  developer”,        “Project  management”,        “Technical  SEO  support”    ] }
  3. 3. If you build it, they will come is a lie 3
  4. 4. re al vSEO For DevelopersHow SEO changed the way I developDate: February 29, 2012Author: Chris Le (@djchrisle) 4
  5. 5. 5
  6. 6. @djchrisle 6
  7. 7. #  header.html.erb<h1>&nbsp;</h1>....#  acme.cssh1  {      background-­‐image:  ‘/img/acme_logo.png’;      background-­‐repeat:  no-­‐repeat;} @djchrisle 7
  8. 8. #  investments.html.erb<a  href=”#watchlist”><div  id=”container”></div><script>    $(“#watchlist”).click  (function()  { //  =>  sets  loadThis  to  “watchlist”        var  loadThis  =  $.param.fragment($.param.querystring);        $(“#container”).load(“/content?get=”  +  loadThis);    }</script>#  content_controller.rbclass  ContentController  <  ActionController::Base    respond_to  :html    def  index        @content  =  Content.find_by_name(params[:get]        respond_with(@content)    endend @djchrisle 8
  9. 9. http://www.acme.com/investments#positionshttp://www.acme.com/investments#watchlisthttp://www.acme.com/investments#menu1http://www.acme.com/investments#menu2 @djchrisle 9
  10. 10. Best Practices• Modularize & reuse code – DRY principals (Don’t Repeat Yourself)• Abstract template and view from logic – Independently change stuff - no problems• Use async JS loading to reduce load – Lower server costs – Fast load time (aka: “site speed”) @djchrisle 10
  11. 11. http://www.domain.com/about-­‐us/blog/posthttp://www.domain.com/blog/post @djchrisle 11
  12. 12. Q: What is SEO? A: Help the RIGHTcustomers find YOU. 12
  13. 13. About us 13
  14. 14. @djchrisle 14
  15. 15. @djchrisle 15
  16. 16. @djchrisle 16
  17. 17. require  anemoneAnemone.crawl("http://www.example.com/")  do  |anemone|    anemone.on_every_page  do  |page|            puts  page.url    endendBank.account  <<  Profit! @djchrisle 17
  18. 18. @djchrisle 18
  19. 19. nsfw 19
  20. 20. Title tags @djchrisle 20
  21. 21. ???? 21
  22. 22. #  header.html.erb<title><%=  @company.name  %></title> @djchrisle 22
  23. 23. #  header.html.erb<title><%=  @company.name  %>  <%=  @page.title_tag  %></title> @djchrisle 23
  24. 24. #  header.html.erb<title><%=  @company.name  %>  <%=  @page.title_tag  %></title>#  schema.rbcreate_table  “Page”    t.string  “title_tag”    ...end#  page.rbClass  Page  <  ActiveRecord::Base    belongs_to  :category        def  title_tag        title_tag.defined?  ?  super()  :  self.category.name    endend @djchrisle 24
  25. 25. puts  Page.find(1).inspect{    title_tag:  “Experienced  Ruby  Programmers  in  Philladelphia”,    content:  “...”} @djchrisle 25
  26. 26. Title matches keyword + is what user is looking forMy Company | Experienced Ruby Programmers in Philadelphia 26
  27. 27. <h1> tags @djchrisle 27
  28. 28. #  post/index.html.erb<h1><%=  @post.title  %></h1> @djchrisle 28
  29. 29. @djchrisle 29
  30. 30. @djchrisle 30
  31. 31. #  my_page.html.erb<h1>&nbsp;</h1>....#  acme.cssh1  {      background-­‐image:  ‘/img/acme_logo.png’;      background-­‐repeat:  no-­‐repeat;} @djchrisle 31
  32. 32. This page is about “Non-breaking space?”#  my_page.html.erb<h1>&nbsp;</h1>....#  acme.cssh1  {      background-­‐image:  ‘/img/acme_logo.png’;      background-­‐repeat:  no-­‐repeat;} @djchrisle 32
  33. 33. Better use of H1#  my_page.html.erb<div  class=”logo”></div><h1>  Sensible  Investment  Strategies  </h1>....#  acme.css.logo  {      background-­‐image:  ‘/img/acme_logo.png’;      background-­‐repeat:  no-­‐repeat;} @djchrisle 33
  34. 34. URLs &Hash fragments @djchrisle 34
  35. 35. http://www.acme.com/investments#positionshttp://www.acme.com/investments#watchlisthttp://www.acme.com/investments#menu1http://www.acme.com/investments#menu2 @djchrisle 35
  36. 36. http://www.acme.com/investments#positions http://www.acme.com/investments#watchlist http://www.acme.com/investments#menu1 http://www.acme.com/investments#menu2 4 pages .. 1 listing :(Acme Inc | Financial Portfolio Managerswww.acme.com/investments @djchrisle 36
  37. 37. Uncrawlable URL#  investments.html.erb<a  href=”#watchlist”><div  id=”container”></div><script>    $(“#watchlist”).click  (function()  { //  =>  sets  loadThis  to  “watchlist”        var  loadThis  =  $.param.fragment($.param.querystring);        $(“#container”).load(“/content?get=”  +  loadThis);    }</script> 37
  38. 38. Crawlable URL#  investments.html.erb<a  href=”/investments/watchlist”><div  id=”container”></div><script>    $(“#watchlist”).click  (function()  {        $(“#container”).load($.param.querystring);    }</script> 38
  39. 39. #  routes.rbresources  :investmentsmatch  “content/:section”  =>  “content#show”#  content_controller.rbclass  ContentController  <  ActionController::Base    respond_to  :html    def  show        @content  =  Content.find_by_name(params[:section])        respond_with(@content)    endend @djchrisle 39
  40. 40. http://www.acme.com/investments/positions http://www.acme.com/investments/watchlist http://www.acme.com/investments/menu1 http://www.acme.com/investments/menu2 4 pages .. 4 listings :)Acme Inc | Financial Portfolio Managerswww.acme.com/investments/positions @djchrisle 40
  41. 41. 301 / 302 redirect @djchrisle 41
  42. 42. http://www.domain.com/about-­‐us/blog/posthttp://www.domain.com/blog/post @djchrisle 42
  43. 43. #  content_controller.rbclass  ContentController  <  ActionController::Base    respond_to  :html    def  show        redirect_to  :post_path        #  @content  =  Content.find_by_id(params[:id])        #  respond_with(@content)    endend @djchrisle 43
  44. 44. Defaults as 302 response#  content_controller.rbclass  ContentController  <  ActionController::Base    respond_to  :html    def  show        redirect_to  :post_path        #  @content  =  Content.find_by_id(params[:id])        #  respond_with(@content)    endend @djchrisle 44
  45. 45. 301 vs 302 redirect• RFC 2616, Section 10.3.3 – 302 Found: The requested resource resides temporarily under a different URI• RFC 2616, Section 10.3.2 –301 Moved Permanently: The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs @djchrisle 45
  46. 46. 46
  47. 47. 302 =nothing 47
  48. 48. 301 =change 48
  49. 49. 404 = delist 49
  50. 50. #  content_controller.rbclass  ContentController  <  ActionController::Base    respond_to  :html    def  show        redirect_to  :post_path,  :status  =>  301        #  @content  =  Content.find_by_id(params[:id])        #  respond_with(@content)    endend @djchrisle 50
  51. 51. #  content_controller.rbclass  ContentController  <  ActionController::Base    respond_to  :html    def  show        redirect_to  :post_path,  :status  =>  301        #  @content  =  Content.find_by_id(params[:id])        #  respond_with(@content)    endend @djchrisle 51
  52. 52. #  routes.rbmatch  “/about-­‐us/blog/:post_title”  =>      redirect(“/blog/#{params[:post_title]}”) 52
  53. 53. If you build it, they will come is a lie 53
  54. 54. Every great idea deserves thechance to be found @djchrisle 54
  55. 55. re al vSEO For DevelopersHow SEO changed the way I developDate: February 29, 2012Author: Chris Le (@djchrisle) 55
  56. 56. Q&A@djchrisle 56
  57. 57. 2006-2007 57
  58. 58. 58
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×