大网数据广告活动
网站运营与故障问答

Hidden "< prev" and "next >" pagination links on first and last page respectively

· 52CE 我爱测

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 (p…

问题原文

原帖链接 · Arth · CC BY-SA 3.0

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!

已采纳解答

原帖链接 · unor · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-06-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。