WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 2 months ago

#10180 reopened enhancement

Add rel="prev" to previous_posts_link() and rel="next" to next_posts_link()

Reported by: singpolyma Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch, needs-testing
Focuses: template Cc:

Description

Putting proper rel values on archive next/previous links is actually not even properly possible with a plugin, so I had to use a patch

http://gist.github.com/120586

Really this should (IMHO) all go into core

http://singpolyma.net/2009/05/rel-prev-next-wordpress/

Attachments (1)

10180-link-template.php.diff (1.2 KB) - added by mtekk 5 years ago.
This is my first go at adding in the rel="next" and rel="prev". There is probably a better/faster way of doing this.

Download all attachments as: .zip

Change History (14)

comment:1 demetris5 years ago

  • Cc dkikizas@… added

What version is this patch against?

  1. 2.8 already generates some rel links of this type: prev (post), next (post), home, index.

See: http://core.trac.wordpress.org/ticket/8703

comment:2 Denis-de-Bernardy5 years ago

  • Keywords close added
  • Milestone changed from Unassigned to 2.8.1

this seems very invalid to me

comment:3 dd325 years ago

  • Keywords close removed

#8703 added next/prev/home for single browsing, But not for archive browsing.

/archive/2009/05/ should have a next for /archives/2009/06/ etc.

I'm pretty sure thats what this ticket is asking for.

comment:4 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.8.1 to 2.9
  • Type changed from defect (bug) to enhancement

comment:5 Denis-de-Bernardy5 years ago

  • Component changed from General to Template

comment:7 follow-up: mtekk5 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

I'm closing this as a duplicate of #4209. Also, the code in that github link is not a good patch as it could add a duplicate rel= attribute to the link. The patch in #4209 checks for this.

comment:8 mtekk5 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened
  • Summary changed from rel=prev/next to Add rel="prev" to previous_posts_link() and rel="next" to next_posts_link()

I guess I should really pay more attention to things. #4209 and this cover different things (previous_post_link() vs previous_posts_link() and the next equivalents). I'm reopening and I'll have a patch soon.

mtekk5 years ago

This is my first go at adding in the rel="next" and rel="prev". There is probably a better/faster way of doing this.

comment:9 mtekk5 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

comment:10 miqrogroove4 years ago

This needs to hit similar functions such as previous_image_link() and next_image_link()

comment:11 ryan4 years ago

  • Milestone changed from 2.9 to Future Release

comment:12 in reply to: ↑ 7 singpolyma3 years ago

Replying to mtekk:

Also, the code in that github link is not a good patch as it could add a duplicate rel= attribute to the link. The patch in #4209 checks for this.

I'm very aware that the patch+plugin I posted is a hack and not an actual solution.

comment:13 nacin2 months ago

  • Component changed from Template to Posts, Post Types
  • Focuses template added
Note: See TracTickets for help on using tickets.