backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 39 forks source link

Taxonomy term feeds #2312

Closed amilenkov closed 6 years ago

amilenkov commented 7 years ago

I have a Backdrop site where taxonomy terms feed pages are empty despite corresponding normal term pages have content.

http://www.pkk-bg.com/tags/plastmasi (term ID = 3) http://www.pkk-bg.com/taxonomy/term/3/feed

In the head part of the HTML code of http://www.pkk-bg.com/taxonomy/term/3/feed there is a line

<link rel="alternate" type="application/rss+xml" title="RSS - Пластмаси" href="http://pkk-bg.com/taxonomy/term/3/feed" />

Google has indexed these feed pages and shows them in search listings as empty pages:

https://www.google.bg/search?hl=bg&as_q=www.pkk-bg.com&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=&as_occt=any&safe=images&as_filetype=&as_rights=

Is this normal, it seems to me as a problem. For SEO and for visitors that use RSS readers.

Are there some settings that can solve this.

In Drupal 7 sites these taxonomy terms feed pages work normal and display content.

May be this is related to your plan to convert taxonomy terms feed pages to views. I have red about this plan and understand that it is not yet realized.

--

PR by laryn

herbdool commented 7 years ago

It might be particular to this site. I tried it on another Backdrop site and the feed at the end gave me an XML file to download. Check to see if you've got a View that's intercepting this path.

laryn commented 7 years ago

I can verify that this is a bug and it can even be seen on BackdropCMS.org: https://backdropcms.org/taxonomy/term/2/feed

feed

The XML at the top shows an empty RSS channel, followed by HTML code that should not appear in the feed.

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="https://backdropcms.org"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Backdrop CMS - Releases</title>
 <link>https://backdropcms.org/tags/releases</link>
 <description></description>
 <language>en</language>
</channel>
</rss>
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
[snip]
jenlampton commented 7 years ago

The views feeds do seem to be outputting correctly formatted XML, see https://backdropcms.org/project/rss.xml and https://backdropcms.org/security/rss.xml. I bet there's something wrong with the taxonomy module's handling of these feed pages.

laryn commented 7 years ago

I'm looking into this. I found one issue and have one more yet to find...

laryn commented 7 years ago

This PR fixes an issue with the feeds (it was trying to pull from a non-existent config file), which gets the content to start showing up in the feed.

I haven't figured out why it is still tacking on extraneous HTML at the end of the feed, but that should be removed as well. I did see that this is using a function (node_feed) that is deprecated but I'm not sure what is supposed to be used instead.

laryn commented 7 years ago

I just updated the PR and think this is solved. Can anyone review?

jenlampton commented 7 years ago

I can confirm that the PR fixes the issue, check out b.org: https://backdropcms.org/taxonomy/term/2/feed

screen shot 2017-09-15 at 2 49 23 pm
quicksketch commented 7 years ago

PR is causing NodeFeedTestCase test to fail unfortunately, though it does fix the issue.

Adding exit() in this case is probably fine as long as we can fix the associated test. As an alternative, we can prevent Layout from attempting to add HTML to the end of the page by specifying a delivery callback in hook_menu(). If a delivery callback is specified (such as ajax_deliver or backdrop_json_deliver) then Layout will not attempt to wrap the menu response. Unfortunately we have no delivery callback type for XML or RSS feeds currently. We could add one and then use it to solve this problem in an alternative approach.

laryn commented 6 years ago

@quicksketch @jenlampton Can you test the latest PR? I copied the delivery callback from the rss.xml menu item in the node module, which also uses the node_feed function and seems to work fine.

jenlampton commented 6 years ago

Pushed the new fix to backdropcms.org. I can confirm that the latest PR also fixes the issue: https://backdropcms.org/taxonomy/term/2/feed

quicksketch commented 6 years ago

Thanks @laryn for the updated PR! The new fix is great and cleaner. I've merged https://github.com/backdrop/backdrop/pull/2010 into 1.x and 1.8.x. Thanks!