3

I'm using the Yii Framework, with Bootstrap 3, and have noticed the default pagination behavior on the first and last pages is a little strange.

On page 2 of 3 the links look like:

< Prev | 1 | 2 | 3 | Next >

On the first page (page 1) the < Prev link is hidden (not disabled or removed), but is capped to point at the first page (page 1) again.

On the last page (page 3) the Next > link is hidden, but is capped to point at the last page (page 3).

The current page link also has the CSS cursor:default but does allow clicks.

To help the crawlers I have added rel="next/prev" to the relevant links.

I am tempted to remove the next and previous link entirely on the first and last page, respectively, and to disable the current page link (or even change it to a span). Would this be advisable? I would have thought this would make more sense to a crawler.

Is there a reason for the framework to include these hidden capped links on the page? It seems to have been deliberately coded in.

UPDATE

OK, so I just read up on it a bit more.

I thought the rel="next/prev" was supposed to be added to the link (<a>) tags in the body, not as it clearly states to additional link (<link>) tags in the head.. which was particularly foolish of me.

This was the main source of my concern, but I guess the question is still valid, so I will let it stand!

  • 1
    I assume that these pagination HTML elements have been thoroughly researched and the implementation is fine. Certainly enough time has existed for this to happen. I would leave it as it is and see what happens. You can also compare your code to other sites to see what they do. I would suggest looking at major in the know sites such as MOZ. Cheers!! – closetnoc Jun 15 '16 at 16:12
  • 1
    Nothing to worry about. Google doesn't consider navigation elements as content in any-case, and even if it was content you was hiding, it still would be ok, as it just won't be counted to page weight without a visible trigger. Cloaking isn't the same it was almost 2 decades ago. – Simon Hayter Jun 15 '16 at 18:17
  • 1
    It’s perfectly fine to provide the next/previous link types on a elements (depending on the consumer, you could provide link elements for these in addition). – unor Jun 16 '16 at 15:21
  • @unor Thanks for the hint, I may leave them off the <a> tags in this case, because the hidden links actually point to the current page (when on the first or last page) which was what originally worried me. – Arth Jun 16 '16 at 15:35
1

The best practice is to omit the previous link (on the first page) and the next link (on the last page), because

  • user agents without CSS support will display them, which might confuse users
  • having them is pointless

The link to the current page would ideally be omitted, too, because

  • user agents without CSS support will display it in the same way like the other links, so users might not be able to tell on which page they currently are
  • having it is pointless

Having or not having these links should have no effect on SEO, though.

I can’t imagine any reason why having these hidden links would be a good idea. My guess (without checking their code) is that they kept them because it was easier to implement it like that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.