Updated as per #19
Problem/Motivation
RSS feed of term page contains local URL.
Proposed resolution
We can fix it either way.
- Add RSS link formatter to taxonomy.
- Add option to taxonomy link formatter to show absolute url.
- If view mode is RSS change the taxonomy link formatter url to absolute.
Remaining tasks
Agree on the solution.
Patch for solution:
User interface changes
For option:
- 1 field_tags formatter should be changed.
- 2 field_tags formatter should check the absolute URL option.
- 3 None.
API changes
For option:
- 1 adds new taxonomy formatter.
- 2 adds new option to the existing taxonomy link formatter.
- 3 just converts the url to absolute if view mode is RSS.
Original report by @wuinfo
When generating taxonomy feed under "taxonomy/term/%taxonomy_term/feed", Drupal rendered tag URL without using absolute URL. As result, RSS feed contains local URL of the taxonomy terms.
This cause other sites using the feed have problem of "404 page not found" on those taxonomy terms.
Here are example links from Acquia Drupal Planet.
https://www.drupal.org/aggregator/sources/174
https://www.drupal.org/resources/drupal-sprint (404 page not found)
https://www.drupal.org/resources/global-sprint-weekend (404 page not found)
https://www.drupal.org/resources/acquia-drupal-planet (404 page not found)
I have attached a patch to this issue.
The patch adds a new field format that render the link in absolute format.
Before
After
Beta phase evaluation
Unfrozen changes | Unfrozen because it is a bug fix |
---|
Comment | File | Size | Author |
---|---|---|---|
#24 | taxonomy_term_feed_url.patch | 1.58 KB | wuinfo - Bill Wu |
Comments
Comment #1
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedComment #2
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedComment #3
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedComment #4
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedImages of before and after fix uploaded.
Comment #5
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedThis is the patch for 8.0.x
Comment #6
xjm@wuinfo confirmed that the problem exists in both D8 and D7. Thanks!
Something we definitely need here is an automated test that fails with the bug in HEAD, and passes with the patch applied.
It'd also help to have step-by-step testing instructions and before/after samples of the feed contents (screenshots, whatever). Another thing that's also not clear to me is whether this only affects taxonomy feed items -- can we confirm that the problem does not exist elsehwere? Are there other items in core we should check? Thanks!
Comment #7
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedThanks @xjm.
The problem is the default field link is rendered relative url into feed.
The patch is give an option of "Rss Link". The new option will render the taxonomy term link into absolute URL.
Comment #8
xjmOops, I missed that screenshots are already attached! Embedding them here.
Before
After
Comment #9
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedHi @xjm, I removed "Needs tests" tag for this issue.
This patch adds "RSS Link" option in admin/structure/types/manage/article/display . There are no test script for existing options like "Link" and "Plain text".
Comment #10
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedComment #11
xjm@wuinfo, there are definitely gaps in our existing test coverage. However, per our core testing gate, bugfixes need to be accompanied by a test that will prevent the bug from regressing in the future.
Thanks for the screenshot!
Comment #12
xjmConfirmed with @alexpott that a bug fix here would need a test.
Comment #13
jibranI think creating a new formatter is not a good solution. I think we should add absolute option to existing link formatter to show the absolute url.
Comment #14
jibran:/
Comment #18
jibranI thought I had also added the schema changes.
Comment #19
jibranHere is new and simple fix. Updated IS and added BE.
Comment #20
jibranBetter title. FWIW I think #19 is much better option then all others.
Comment #21
larowlannice
Comment #22
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedThanks @xjm, Thanks jibran.
Comment #23
alexpottI don;t think this is the correct fix. There could be other view modes that need absolute urls.
Comment #24
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedHi @alexpott,
Patches at in #5 and #18 let other view modes to use the absolute URLs. Both for Drupal 8
Here is the patch for Drupal 7 attached to this comment. This Drupal 7 patch is a similar solution to #5 patch for Drupal 8.
Comment #25
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedComment #27
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedIn order to check the patch at #24 with Drupal 7 version. Change the version to 7.x-dev, will change it back later.
Comment #29
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedComment #30
jibranFrom
EntityReferenceTaxonomyTermRssFormatter::viewElements()
See absolute => true it is fixed in D8 HEAD
Moving back to D7.
Comment #31
ron_s CreditAttribution: ron_s commentedThe patch in #24 works for us, but it should be modified to match the changes being made in this issue: https://www.drupal.org/node/2128265
I'm including a new patch for review that makes these updates.
Comment #32
ron_s CreditAttribution: ron_s commentedFYI, issue #2128265 is postponed, so the patch I created for #31 is no longer valid. Please review patch #24 instead.