Ticket #5435 (closed defect (bug): fixed)

Opened 4 years ago

Last modified 4 years ago

Incorrect id, self link and alternate link in the Atom comment feed of each entry

Reported by: peaceablewhale Owned by: ryan
Priority: normal Milestone: 2.5
Component: General Version:
Severity: normal Keywords: Atom, Comment Feed, has-patch
Cc:

Description

The id, self link and alternate link in the Atom comment feed of each entry is incorrect. Using an entry of the WordPress development blog,  http://wordpress.org/development/2007/10/wordpress-231/feed/atom/, as an example:

The following code is not correct...

<id>http://wordpress.org/development/comments/feed/atom/</id>
<link rel="self" type="application/atom+xml" href="http://wordpress.org/development/comments/feed/atom/" />
<link rel="alternate" type="text/html" href="http://wordpress.org/development" />

The correct code should be...

<id>http://wordpress.org/development/2007/10/wordpress-231/feed/atom/</id>
<link rel="self" type="application/atom+xml" href="http://wordpress.org/development/2007/10/wordpress-231/feed/atom/" />
<link rel="alternate" type="text/html" href="http://wordpress.org/development/2007/10/wordpress-231/#comments" />

Does anybody know how to correct them?

Attachments

fix_atom_comments_metadata.patch Download (1.0 KB) - added by ionfish 4 years ago.

Change History

comment:1 follow-up: ↓ 2   ionfish4 years ago

  • Keywords Feed, has-patch added; Feed removed
  • Owner changed from anonymous to ionfish
  • Status changed from new to assigned
  • Severity changed from major to normal

comment:2 in reply to: ↑ 1   peaceablewhale4 years ago

Replying to ionfish: Thanks for the fix. I have a comment on it:

the_permalink(); returns the permalink of the entry only. Should the alternate link refer to the comment part of the entry by adding "#comments" after the permalink?

  • Owner changed from ionfish to ryan
  • Status changed from assigned to new

Not all templates have an element with the id 'comments', but I imagine the developer who commits the fix will add it (or mention it here) if they feel it's appropriate (I suppose it would be in line with the behaviour of some other links functions).

Ideally we'd also include self and alternate links and id values for searches as well, rather than simply using the root values, but that was beyond the scope of the five minutes I had to write this in. We probably need a search_feed_link() function (a noticeable omission from r6365); I might make a new ticket and set about writing one.

A #comments anchor obviously isn't required for a theme, but WordPress assumes it's there when it creates many links (such as the comments link).

comment:5   ryan4 years ago

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

(In [6414]) Fix id, self link and alternate link in Atom comment feeds. Props ionfish. fixes #5435

Note: See TracTickets for help on using tickets.