homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

How can I fix this pagination formula?

 4:27 pm on Apr 10, 2011 (gmt 0)

The CMS I'm using paginates user comments. I set it to show 5 comments per page with the latest comments on top. And I have 11 comments. And show the last page first.

Currently, this is what the CMS does:

Page 1 shows comments 5, 4, 3, 2, 1
Page 2 shows comments 10, 9, 8, 7, 6
Page 3 shows comment 11

Here's the problem, since I told the CMS that I want to show latest comments first and last page first, it shows page 3 first, so the user only sees 11. To see the rest of the comment, user has to click on "See older comments ->" to go to page 2, etc.

The behavior I'd rather have is this:

Page 1 shows comment 1
Page 2 shows comments 6, 5, 4, 3, 2
Page 3 shows comments 11, 10, 9, 8, 7

Here's the code that needs to be fixed: [pastebin.mozilla.org...]



 4:38 pm on Apr 10, 2011 (gmt 0)

With your new scheme think about what is indexed compared to what is really on the page if you add some comments. User will arrive at a page based on what they saw in the SERPs, but that content will no longer be on THAT page.

Think about how, after adding 5 comments, the new page two is a duplicate of the old page one and the new page three is a duplicate of the old page two, and previously that content was originally on page one. See also that there are up to 5 sets of these duplicate pages (because there are 5 comments per page). Extend this over a long period of time to see how much of an indexing mess this creates.


 5:18 pm on Apr 10, 2011 (gmt 0)

g1smd, Page 3, which is the default first page that the user sees, does not have its own URL. It shares the same URL with the "content" page. That is: http://example.com/foobar/ shows Page 3 of comments. Page 2 of comments is located at http://example.com/foo/comments-page-2/ and Page 1 of comments is at http://example.com/foo/comments-page-1/. Newer comments push older comments down.

There are no duplicate content issues here. Even if there were, I'd be able to handle it with rel="canonical" no problem. I also link to sitemap.xml from robots.txt to tell engines what the main pages are. I don't include comments pages there.

Thanks for your concern.

I'd really love some help with the formulas!


 5:36 pm on Apr 10, 2011 (gmt 0)

To be clear, you're saying that comments 1 to 5 are always on the page that has "page-1" as its URL?

If so, then that's a good thing.


 5:54 pm on Apr 10, 2011 (gmt 0)

No, comments 1-5 will move up the pages as more comments come in. At first, comments 1-5 will be on http://example.com/foo/. When 5 more comments come in, 1-5 will be on page-1. After yet another five comments, they'll move to page-2, etc...But that won't cause any SEO damage. There will be no duplicate content. The engines will just have to update their data -- like they have to do with all other dynamic sites...

EDIT: No I think I'm wrong here. They'll remain on page-1. Newer comments will go to page-2 and page-2 will be displayed before page-1 in pagination.

[edited by: msafi at 5:58 pm (utc) on Apr 10, 2011]


 5:58 pm on Apr 10, 2011 (gmt 0)

Yes, and that is the point. The same content keeps swapping to a different URL, and because of that some content will be indexed on multiple page URLs and other content will not be indexed at all when you take a snapshot at any particular point in time.

This is a fundamental and damaging flaw in site design, yet one that people shrug off without looking in depth at the consequences. It is quite possible to design a dynamic site where the whole site content does not swap to new URLs every time something else is added.

EDIT: If comments 1 to 5 are always found at the URL "page-1", with the newest content on the highest numbered page URLs, the problem is fixed.


 6:02 pm on Apr 10, 2011 (gmt 0)

Please check my edit. Also, I'm sorry but even if the comments kept moving to different URLs, I wouldn't consider this to be an issue.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved