Skip to content

Instantly share code, notes, and snippets.

@duvillierA
Created December 3, 2013 10:27
Show Gist options
  • Save duvillierA/7767094 to your computer and use it in GitHub Desktop.
Save duvillierA/7767094 to your computer and use it in GitHub Desktop.
Seo pagination
As a reminder , a few seo rules for pagination :
* behaviour of the page parameter
- ?page=-1 ---> 404
- ?page=abc ---> 404
- ?page=0 ---> 404
- ?page=1000 (any number>max) ----> 404
- ?page=1 ----> 301 to same url without page parameter
if there is already a querystring : page parameter must be always at the same place in url !
/foo/bar?param=ABC&page=2 and /foo/bar?page=2&param=ABC are 2 different urls !
* links to pages
- ?page=1 must NEVER exist, remove the parameter when creating link.
- title of the links going to pages should be ideally : "<current page title OR current page h1> - page X".
Or at least must be "page X"
- <a> links going to the next page should have a rel="next" attribute
- <a> links going to the previous page should have a rel="prev" attribute
- IF there is a next page, we should have a <link rel=next href="absolute link to next page" /> in <head> of the pageeat
- IF there is a prev page, we should have a <link rel=prev href="absolute link to next page" /> in <head> of the page
Warning, wrong pagination implementation could completely destroy the seo . (think : infinite pagination, by forgetting a check to remove the "next" link or attribute !)
* List size :
- I try to push 20 elements by page on public pages; In most usecases, the less pages, the better it is for both users and google, We might set different element count on logged in pages.
* pagination and canonical
- page parameter is always included in the canonical url.
eg :
*/foo/bar/?category=00229gb7g3lzewil&amp;country=fr&pageNumber=4
<link rel="canonical" href="*/foo/bar/?category=00229gb7g3lzewil&amp;country=fr&amp;pageNumber=4" >
<link rel="prev" href="*/foo/bar/?category=00229gb7g3lzewil&amp;country=fr&amp;pageNumber=3">
<link rel="next" href="*/foo/bar/?category=00229gb7g3lzewil&amp;country=fr&amp;pageNumber=5">
the more rule we could include in framework, the less errors we will have in implementation !
thx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment