WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 15 months ago

#34083 assigned enhancement

Feed for post type should link to post type archive if available

Reported by: joostdevalk Owned by: stevenkword
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Feeds Keywords: has-patch dev-feedback
Focuses: Cc:

Description

This post type feed: https://yoast.com/dev-blog/feed/

has

<link>https://yoast.com</link>

Even though that particular post type has a post type archive. IMHO, it should link to the post type archive https://yoast.com/dev-blog/.

Attachments (3)

34083.patch (3.6 KB) - added by stevenkword 3 years ago.
First pass at addressing the problem
34083.2.patch (3.6 KB) - added by stevenkword 3 years ago.
Adds check for populated query object keys
34083.3.diff (2.9 KB) - added by stevenkword 15 months ago.

Download all attachments as: .zip

Change History (13)

#1 @joostdevalk
3 years ago

(BTW I filtered it on yoast.com so it's fixed there now)

#2 @DrewAPicture
3 years ago

Is there any particular downside to not actually providing a link element back to the homepage of the site?

#3 @joostdevalk
3 years ago

[The spec](http://cyber.law.harvard.edu/rss/rss.html) says:

link The URL to the HTML website corresponding to the channel.

If you're looking at a post type feed, the URL doesn't correspond to that at all, leading to weird behavior.

#4 @rmccue
3 years ago

Makes sense to link back to the HTML representation of the feed, +1.

#5 @stevenkword
3 years ago

  • Keywords has-patch added
  • Owner set to stevenkword
  • Status changed from new to assigned

I like this idea, so I've taken a stab at the solution in 34083.patch. Admittedly, this new function is not very unit-testable, which I will probably address in a future patch. However, if anyone wants to take a look now, I'd love a second opinion. There were some other ways to approach the problem. This approach, while a little complicated, avoids regex and string functions and therefore should work with any permalink structure or lack thereof.

@stevenkword
3 years ago

First pass at addressing the problem

#6 @DrewAPicture
3 years ago

  • Milestone changed from Awaiting Review to Future Release

@stevenkword
3 years ago

Adds check for populated query object keys

#7 @stevenkword
3 years ago

  • Type changed from defect (bug) to enhancement

#8 @stevenkword
2 years ago

  • Keywords dev-feedback added

#9 follow-up: @swissspidy
16 months ago

  • Keywords needs-refresh added

Seems reasonable to me. Patch looks overly complex at first glance though. Also, do we have to access $wp_query directly?

#10 in reply to: ↑ 9 @stevenkword
15 months ago

  • Keywords needs-refresh removed

Replying to swissspidy:

Seems reasonable to me. Patch looks overly complex at first glance though. Also, do we have to access $wp_query directly?

Simplified quite a bit in 34083.3.diff. No more direct access to WP_Query.

Note: See TracTickets for help on using tickets.