J! 3.x newsfeed displays "incorrect" links

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Post Reply
User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Wed Mar 14, 2018 6:53 am

It isn't often that I have to admit defeat but I have a problem that has baffled me for hours. I have a dislike of news feeds in general and I don't normally use news feeds in my webcraft; I have a client and she wants a specific news feed source to be displayed in her website.

The Joomla menu item type "Single News Feed" allows one to display a feed from an item in the News Feed component. No problems so far. It's a simple matter of going to Components » New Feeds » Feed and entering values for Title and Link.

I've got a problem with most of the news feeds that my client wants but here is one example. This is the URL of the feed: https://www.copybook.com/military/rss/news.xml

The problem comes about when you add the menu item linked to this feed. Yes, it displays a lovely list of news items (and images) but the links on the J! 3 website are all wrong. The links use the guid information.

My client's problems began when she had a J! 1.5 website that was brutally hacked. No worries, I was able to salvage a working version which I quickly migrated to J! 3.8.5 and the rebuild is starting to look OK. On the original [J! 1/5 site] the newsfeed displays the RSS feed and the URLs are all good. The same cannot be said of the J! 3.8 site. There's been a change in the way that newsfeeds generate the links.

In J! 3.8, the URLs are generated by lines 94-95 of /components/com_newsfeeds/views/newsfeed/tmpl/default.php

Code: Select all

		<?php $uri   = !empty($this->rssDoc[$i]->guid) || $this->rssDoc[$i]->guid !== null ? trim($this->rssDoc[$i]->guid) : trim($this->rssDoc[$i]->uri); ?>
		<?php $uri   = strpos($uri, 'http') !== 0 ? $this->item->link : $uri; ?>
In J! 1.5, the URLs are generated by lines 64-65 of /components/com_newsfeeds/views/newsfeed/tmpl/default.php

Code: Select all

		<?php if ( !is_null( $item->get_link() ) ) : ?>
			<a href="<?php echo $item->get_link(); ?>" target="_blank">
This is a segment of part of the news feed's XML file:

Code: Select all

    <item>
      <title>South Korea, U.S. Begin Joint Naval Drills Amid North Korean Threat</title>
      <description><p>SEOUL, South Korea - South Korean and U.S. troops have begun five days of joint naval drills amid North Korea's renewal of its threat to fire missiles near the American territory of Guam.</p> <div><img src="https://www.copybook.com/img/nm8676s52762/south-korea-us-begin-joint-naval-drills-amid-north-korean-threat.jpg?v=1509463589" /></div></description>
      <link>https://www.copybook.com/news/south-korea-u-s-begin-joint-naval-drills-amid-north-korean-threat</link>
      <author>Charley Wheeler</author>
      <guid>https://www.copybook.com/news/south-korea-u-s-begin-joint-naval-drills-amid-north-korean-threat Mon, 16 Oct 2017 09:31:21 +0000</guid>
      <pubDate>Mon, 16 Oct 2017 09:31:21 +0000</pubDate>
    </item>
You will see there is a <link> element and a <guid> element.

It looks like J! 3.8 uses the <guid> element and J! 1.5 used the <link> element.

In the example case above, the link in the <guid> leads to a 404 "not found" whereas the <link> URL is the correct one.

Two questions:

1) Is this a defect in J! 3.8; and
2) Regardless of whether the XML file follows the recommendations of the W3C, was there another good reason to use the <guid> path in J! 3.8 instead of the <link> path?
Last edited by toivo on Tue Jun 26, 2018 8:54 pm, edited 1 time in total.
Reason: mod note: marked as solved on request
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26121
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: J! 3.x newsfeed displays "incorrect" links

Post by Per Yngve Berg » Wed Mar 14, 2018 8:52 am

https://www.w3schools.com/xml/rss_tag_guid.asp

The GUID have the Pubdate added. I cannot say which on is the correct implementation.

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Wed Mar 14, 2018 9:00 am

Thanks for replying, Per. I read the article you referred to (I read it about 10 hours ago, actually).

The problem in J! 3.x is that the news feed view—the menu item—uses the <guid> element for creating the URLs. In J! 1.5 the news feed view (i.e. the menu item) used the <link> element.

It is of little matter whether the example I gave is logically correct or not; the problem affects all J! 3.x websites.

My questions are
1) Is this a defect in J! 3.8; and
2) If it is a deliberate design feature of J! 3.x what was the reasoing behind using the <guid> path in J! 3.8 instead of the <link> path (as it was done in J! 1.5)?
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Wed Mar 14, 2018 9:13 am

For the sake of completeness of information: the website I'm using for this "news feed" matter is almost straight out-of-the-box Joomla with only Akeeba Backup, Akeeba Admin Tools and JCE Editor components added; everything else is Joomla-standard.

[
Forum Post Assistant (v1.3.9) : 14th March 2018 wrote:
Basic Environment :: wrote:Joomla! Instance :: Joomla! 3.8.6-Stable (Amani) 13-March-2018
Joomla! Platform :: Joomla Platform 13.1.0-Stable (Curiosity) 24-Apr-2013
Joomla! Configured :: Yes | Read-Only (444) | Owner: --protected-- . (uid: 1/gid: 1) | Group: --protected-- (gid: 1) | Valid For: 3.8
Configuration Options :: Offline: 0 | SEF: 1 | SEF Suffix: 0 | SEF ReWrite: 1 | .htaccess/web.config: Yes | GZip: 0 | Cache: 0 | CacheTime: 15 | CacheHandler: file | CachePlatformPrefix: 0 | FTP Layer: 0 | Proxy: 0 | LiveSite: | Session lifetime: 15 | Session handler: none | Shared sessions: 0 | SSL: 2 | FrontEdit: 1 | Error Reporting: default | Site Debug: 0 | Language Debug: 0 | Default Access: 1 | Unicode Slugs: 0 | dbConnection Type: mysqli | Database Credentials Present: Yes

Host Configuration :: OS: Linux | OS Version: 3.10.0-714.10.2.lve1.4.79.el6h.x86_64 | Technology: x86_64 | Web Server: Apache | Encoding: gzip, deflate, br | Doc Root: --protected-- | System TMP Writable: Yes | Free Disk Space : 249.90 GiB |

PHP Configuration :: Version: 5.6.34 | PHP API: litespeed | Session Path Writable: Yes | Display Errors: | Error Reporting: 32759 | Log Errors To: error_log | Last Known Error: | Register Globals: | Magic Quotes: | Safe Mode: | Open Base: | Uploads: 1 | Max. Upload Size: 64M | Max. POST Size: 64M | Max. Input Time: 60 | Max. Execution Time: 30 | Memory Limit: 128M

MySQL Configuration :: Version: 5.6.38 (Client:5.6.38) | Host: --protected-- (--protected--) | Collation: utf8mb4_general_ci (Character Set: utf8mb4) | Database Size: 8.74 MiB | #of Tables: 95
Detailed Environment :: wrote:PHP Extensions :: Core (5.6.34) | date (5.6.34) | ereg () | libxml () | openssl () | pcre () | sqlite3 (0.7-dev) | zlib (2.0) | bz2 () | calendar () | ctype () | curl () | hash (1.0) | filter (0.11.0) | ftp () | gettext () | gmp () | SPL (0.2) | iconv () | pcntl () | readline (5.6.34) | Reflection ($Id: 5f15287237d5f78d75b19c26915aa7bd83dee8b8 $) | session () | standard (5.6.34) | shmop () | SimpleXML (0.1) | mbstring () | tokenizer (0.1) | xml () | litespeed () | bcmath () | big_int (1.0.7) | bitset (2.0.3) | dom (20031129) | sockets () | eio (2.0.0) | enchant (1.1.0) | fileinfo (1.0.5) | gd () | imap () | intl (1.1.0) | json (1.2.1) | libevent (0.1.0) | exif (1.4 $Id: 1c8772f76be691b7b3f77ca31eb788a2abbcefe5 $) | mcrypt () | mysql (1.0) | mysqli (0.1) | mysqlnd (mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $) | ncurses (1.0.2) | PDO (1.0.4dev) | pdo_mysql (1.0.2) | pdo_sqlite (1.0.1) | Phar (2.0.2) | posix () | pspell () | soap () | stem (1.5.1) | suhosin (0.9.38) | sysvmsg () | sysvsem () | sysvshm () | uploadprogress (1.0.3.1) | wddx () | xmlreader (0.1) | xmlrpc (0.51) | xmlwriter (0.1) | xsl (0.1) | yaml (1.3.0) | zip (1.12.5) | mhash () | ionCube Loader () | Zend OPcache (7.0.4-devFE) | Zend Guard Loader () | Zend Engine (2.6.0) |
Potential Missing Extensions ::

Switch User Environment (Experimental) :: PHP CGI: No | Server SU: No | PHP SU: No | Custom SU (LiteSpeed/Cloud/Grid): Yes
Potential Ownership Issues: No
Folder Permissions :: wrote:Core Folders :: images/ (755) | components/ (755) | modules/ (755) | plugins/ (755) | language/ (755) | templates/ (755) | cache/ (755) | logs/ (---) | tmp/ (755) | administrator/components/ (755) | administrator/modules/ (755) | administrator/language/ (755) | administrator/templates/ (755) | administrator/logs/ (755) |

Elevated Permissions (First 10) ::
Database Information :: wrote:Database statistics :: Uptime: 4289929 | Threads: 5 | Questions: 1060212145 | Slow queries: 6375 | Opens: 92134 | Flush tables: 1 | Open tables: 22086 | Queries per second avg: 247.139 |
Extensions Discovered :: wrote:Components :: SITE :: WF_FILESYSTEM_JOOMLA_TITLE (2.6.26) 1 | WF_AGGREGATOR_[youtube]_TITLE (2.6.26) 1 | WF_AGGREGATOR_DAILYMOTION_TITL (2.6.26) 1 | WF_AGGREGATOR_VIMEO_TITLE (2.6.26) 1 | WF_AGGREGATOR_VINE_TITLE (2.6.26) 1 | WF_LINK_SEARCH_TITLE (2.6.26) 1 | WF_POPUPS_WINDOW_TITLE (2.6.26) 1 | WF_POPUPS_JCEMEDIABOX_TITLE (2.6.26) 1 | WF_LINKS_JOOMLALINKS_TITLE (2.6.26) 1 | WF_PREVIEW_TITLE (2.6.26) 1 | WF_NONBREAKING_TITLE (2.6.26) 1 | WF_FONTSIZESELECT_TITLE (2.6.26) 1 | WF_MEDIA_TITLE (2.6.26) 1 | WF_VISUALCHARS_TITLE (2.6.26) 1 | WF_ANCHOR_TITLE (2.6.26) 1 | WF_AUTOSAVE_TITLE (2.6.26) 1 | WF_STYLE_TITLE (2.6.26) 1 | WF_FONTCOLOR_TITLE (2.6.26) 1 | WF_CHARMAP_TITLE (2.6.26) 1 | WF_TEXTCASE_TITLE (2.6.26) 1 | WF_LINK_TITLE (2.6.26) 1 | WF_EMOTIONS_TITLE (2.6.26) 1 | WF_VISUALBLOCKS_TITLE (2.6.26) 1 | WF_FORMATSELECT_TITLE (2.6.26) 1 | WF_DIRECTIONALITY_TITLE (2.6.26) 1 | WF_CLEANUP_TITLE (2.6.26) 1 | WF_CLIPBOARD_TITLE (2.6.26) 1 | WF_SEARCHREPLACE_TITLE (2.6.26) 1 | WF_BROWSER_TITLE (2.6.26) 1 | WF_PRINT_TITLE (2.6.26) 1 | WF_KITCHENSINK_TITLE (2.6.26) 1 | WF_FONTSELECT_TITLE (2.6.26) 1 | WF_HR_TITLE (2.6.26) 1 | WF_CONTEXTMENU_TITLE (2.6.26) 1 | WF_SPELLCHECKER_TITLE (2.6.26) 1 | WF_XHTMLXTRAS_TITLE (2.6.26) 1 | WF_TABLE_TITLE (2.6.26) 1 | WF_FULLSCREEN_TITLE (2.6.26) 1 | WF_SOURCE_TITLE (2.6.26) 1 | WF_LAYER_TITLE (2.6.26) 1 | WF_LISTS_TITLE (2.6.26) 1 | WF_STYLESELECT_TITLE (2.6.26) 1 | WF_INLINEPOPUPS_TITLE (2.6.26) 1 | WF_IMGMANAGER_TITLE (2.6.26) 1 | WF_ARTICLE_TITLE (2.6.26) 1 | com_mailto (3.0.0) 1 | com_wrapper (3.0.0) 1 |
Components :: ADMIN :: com_languages (3.0.0) 1 | com_joomlaupdate (3.6.2) 1 | com_media (3.0.0) 1 | Akeeba (6.0.1) 1 | com_search (3.0.0) 1 | com_modules (3.0.0) 1 | com_users (3.0.0) 1 | com_fields (3.7.0) 1 | com_cpanel (3.0.0) 1 | com_cache (3.0.0) 1 | com_templates (3.0.0) 1 | COM_JCE (2.6.26) 1 | com_checkin (3.0.0) 1 | com_plugins (3.0.0) 1 | com_installer (3.0.0) 1 | com_contenthistory (3.2.0) 1 | com_content (3.0.0) 1 | com_login (3.0.0) 1 | com_config (3.0.0) 1 | com_messages (3.0.0) 1 | com_banners (3.0.0) 1 | com_ajax (3.2.0) 1 | com_tags (3.1.0) 1 | com_categories (3.0.0) 1 | com_redirect (3.0.0) 1 | com_menus (3.0.0) 1 | com_postinstall (3.2.0) 1 | com_admin (3.0.0) 1 | com_associations (3.7.0) 1 | Admintools (5.0.2) 1 | com_finder (3.0.0) 1 | com_newsfeeds (3.0.0) 1 |

Modules :: SITE :: mod_articles_news (3.0.0) 1 | mod_articles_archive (3.0.0) 1 | mod_menu (3.0.0) 1 | mod_tags_popular (3.1.0) 1 | mod_articles_popular (3.0.0) 1 | mod_syndicate (3.0.0) 1 | mod_random_image (3.0.0) 1 | mod_feed (3.0.0) 1 | mod_search (3.0.0) 1 | mod_footer (3.0.0) 1 | mod_custom (3.0.0) 1 | mod_login (3.0.0) 1 | mod_articles_categories (3.0.0) 1 | mod_breadcrumbs (3.0.0) 1 | mod_banners (3.0.0) 1 | mod_finder (3.0.0) 1 | mod_stats (3.0.0) 1 | mod_articles_latest (3.0.0) 1 | mod_articles_category (3.0.0) 1 | mod_users_latest (3.0.0) 1 | mod_tags_similar (3.1.0) 1 | mod_whosonline (3.0.0) 1 | mod_related_items (3.0.0) 1 | mod_wrapper (3.0.0) 1 | mod_languages (3.5.0) 1 |
Modules :: ADMIN :: mod_toolbar (3.0.0) 1 | mod_popular (3.0.0) 1 | mod_stats_admin (3.0.0) 1 | mod_menu (3.0.0) 1 | mod_version (3.0.0) 1 | mod_feed (3.0.0) 1 | mod_multilangstatus (3.0.0) 1 | mod_sampledata (3.8.0) 1 | mod_submenu (3.0.0) 1 | mod_custom (3.0.0) 1 | mod_login (3.0.0) 1 | mod_logged (3.0.0) 1 | mod_title (3.0.0) 1 | mod_quickicon (3.0.0) 1 | mod_latest (3.0.0) 1 | mod_status (3.0.0) 1 |

Plugins :: SITE :: plg_fields_text (3.7.0) 1 | plg_fields_media (3.7.0) 1 | plg_fields_integer (3.7.0) 1 | plg_fields_checkboxes (3.7.0) 1 | plg_fields_url (3.7.0) 1 | plg_fields_calendar (3.7.0) 1 | plg_fields_radio (3.7.0) 1 | plg_fields_imagelist (3.7.0) 1 | plg_fields_usergrouplist (3.7.0) 1 | plg_fields_textarea (3.7.0) 1 | plg_fields_user (3.7.0) 1 | plg_fields_color (3.7.0) 1 | plg_fields_editor (3.7.0) 1 | plg_fields_sql (3.7.0) 1 | plg_fields_list (3.7.0) 1 | plg_extension_joomla (3.0.0) 1 | plg_extension_jce (2.6.26) 1 | plg_finder_categories (3.0.0) 1 | plg_finder_contacts (3.0.0) 1 | plg_finder_newsfeeds (3.0.0) 1 | plg_finder_content (3.0.0) 1 | plg_finder_tags (3.0.0) 1 | plg_twofactorauth_totp (3.2.0) 0 | plg_twofactorauth_yubikey (3.2.0) 0 | plg_user_joomla (3.0.0) 1 | plg_user_profile (3.0.0) 0 | plg_user_contactcreator (3.0.0) 0 | plg_content_fields (3.7.0) 1 | plg_content_finder (3.0.0) 0 | plg_content_emailcloak (3.0.0) 1 | plg_content_joomla (3.0.0) 1 | plg_content_pagebreak (3.0.0) 1 | plg_content_vote (3.0.0) 0 | plg_content_loadmodule (3.0.0) 1 | plg_content_jce (2.6.26) 1 | plg_content_pagenavigation (3.0.0) 1 | plg_editors-xtd_fields (3.7.0) 1 | plg_editors-xtd_module (3.5.0) 1 | plg_editors-xtd_pagebreak (3.0.0) 1 | plg_editors-xtd_readmore (3.0.0) 1 | plg_editors-xtd_menu (3.7.0) 1 | plg_editors-xtd_image (3.0.0) 1 | plg_editors-xtd_article (3.0.0) 1 | plg_quickicon_phpversioncheck (3.7.0) 1 | plg_quickicon_extensionupdate (3.0.0) 1 | plg_quickicon_jce (2.6.26) 1 | plg_quickicon_akeebabackup (1.0) 1 | plg_quickicon_joomlaupdate (3.0.0) 1 | PLG_INSTALLER_FOLDERINSTALLER (3.6.0) 1 | plg_installer_webinstaller (1.1.1) 1 | plg_installer_packageinstaller (3.6.0) 1 | plg_installer_jce (2.6.26) 1 | PLG_INSTALLER_URLINSTALLER (3.6.0) 1 | plg_authentication_cookie (3.0.0) 1 | plg_authentication_gmail (3.0.0) 0 | plg_authentication_joomla (3.0.0) 1 | plg_authentication_ldap (3.0.0) 0 | plg_system_logout (3.0.0) 1 | plg_system_highlight (3.0.0) 1 | plg_system_languagecode (3.0.0) 0 | plg_system_fields (3.7.0) 1 | System - Admin Tools (5.0.2) 1 | PLG_SYSTEM_BACKUPONUPDATE_TITL (3.7) 1 | plg_system_redirect (3.0.0) 1 | plg_system_sef (3.0.0) 1 | plg_system_stats (3.5.0) 1 | plg_system_cache (3.0.0) 0 | plg_system_sessiongc (3.8.6) 1 | plg_system_log (3.0.0) 1 | PLG_SYSTEM_AKEEBAUPDATECHECK_T (1.1) 1 | plg_system_jce (2.6.26) 1 | plg_system_debug (3.0.0) 1 | plg_system_updatenotification (3.5.0) 1 | plg_system_remember (3.0.0) 1 | plg_system_p3p (3.0.0) 0 | plg_system_languagefilter (3.0.0) 0 | plg_captcha_recaptcha (3.4.0) 0 | plg_search_categories (3.0.0) 1 | plg_search_contacts (3.0.0) 1 | plg_search_newsfeeds (3.0.0) 1 | plg_search_content (3.0.0) 1 | plg_search_tags (3.0.0) 1 | plg_editors_jce (2.6.26) 1 | plg_editors_tinymce (4.5.8) 1 | plg_editors_codemirror (5.34.0) 1 |
Templates Discovered :: wrote:Templates :: SITE :: protostar (1.0) 1 | beez3 (3.1.0) 1 |
Templates :: ADMIN :: hathor (3.0.0) 1 | isis (1.0) 1 |
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Wed Mar 14, 2018 6:28 pm

I have spent the past 1½ hours building a J! 3.8.6 test site with half-a-dozen examples where "reputable" RSS feeds either pass or fail with Joomla's feed display.

The feeds that pass the test work because the <guid> refers to a valid URL; the feeds that fail are because the <guid> does not refer to a "valid" URL. Some of the feeds that PASS do not pass the W3C RSS validator; some of the feeds that FAIL in Joomla, pass the RSS validator. Go figure! :eek:

I suppose this is not a big-ticket item because, I guess, most people don't even display other websites' RSS feeds within Joomla. It also may not be such an important issue for most people because, even if their websites do display other websites' RSS feeds, they're probably not actually reading the news. ;)

I'm just trying to get a handle on why J! 3's news display doesn't use the <link> element—assuming it exists—from the XML to generate URLs; there's been a design change over the past few years and I'm interested to know the reason behind it. From what I can see in the source code, J! 3's news display utilises the <guid> element—again, assuming it exists—and ignores whatever is in the <link> element.

Personal note to myself: never start a serious technical discussion on the Joomla forum on the same day as there's a new release of Joomla. :(

The test site is http://joomla37.enduring.com.au - see the menu item "News Feed Tests"
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Thu Mar 15, 2018 3:47 am

I've pored over GitHub and I can't find any reference to how or when the design of the New Feed (single feed) display was changed (from the way it was in J! 1.5) to use <guid> and not <link> to generate URLs. Something doesn't feel right to me about this. I would very much appreciate someone with some experience/knowledge in this area to provide some interest.

Before I report this as an action item for the Joomla Issue Tracker, I seek some understanding.

We know that we have no control over how websites around the world construct their RSS feeds. Some websites do it well and other websites do things differently. There are several combinations regarding how different websites generate their feeds:
  1. Feeds that contain <guid> only and the <guid> contains a valid URL
  2. Feeds that contain <guid> only and the <guid> does not contain valid URL
  3. Feeds that contain <link> only and the <link> contains a valid URL
  4. Feeds that contain <link> only and the <link> does not contain valid URL
  5. Feeds that contain both <guid> and <link>, they contain the same information and the URL is valid
  6. Feeds that contain both <guid> and <link>, they contain the same information and the URL is invalid
  7. Feeds that contain both <guid> and <link>, they're different but the <link> URL is valid (and the <guid> is invalid)
  8. Feeds that contain both <guid> and <link>, they're different but the <guid> URL is valid
  9. Feeds that contain both <guid> and <link>, they're different and neither URL is valid
  10. Feeds that contain no <guid> or <link>
The "normal" situation should be case 5.

The News Feed (single feed) display for J! 3.x—definitely for J! 3.8.5 or J! 3.8.6—ignores whatever is in the <link>; it uses the <guid> data from the XML file.

My theory is that the logic should go like this: there is no <guid> or <link> then do not generate URLs; if the <guid> is different to the <link> then use the <link> unless the <link> is missing then use the <guid>; if the <guid> is the same as the <link> then it doesn't matter (use the <guid>). Alternatively, implement an additional configuration setting to determine the priority (i.e. use <guid> in preference to <link> or vice versa).

What do you think? ???
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26121
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: J! 3.x newsfeed displays "incorrect" links

Post by Per Yngve Berg » Thu Mar 15, 2018 8:04 am

landofcode wrote:Stands for Globally Unique Identifier. Sets a string that uniquely identifies an RSS item. If this tag is used, a feed reader may use the string to determine if the RSS item is new. Each guid must be unique and it is up to the webmaster or whoever maintains the RSS file to make sure of this for every guid that is created.
A guid could be a URL pointing to the RSS item content, or not.
It says that the GIUD is for signaling if the feed data is new and the link should be used.

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Thu Mar 15, 2018 8:18 am

If I understand you correctly, Per (thanks for being the only person who's trying to help me), if 50% of the world's RSS feeds are incorrectly constructed—I don't know the exact number—then Joomla doesn't give a damn but basically says "the feed doesn't have a correct <guid> but we're going to use it anyway." Sounds to me like no-one actually uses other sites' news feed data in Joomla any more. Would that be a reasonable conclusion?

Using the test site I referred to earlier, I can point to official websites around the world where the <guid> is different to the <link> and the Joomla News Feed (single item) display doesn't work even though the web browse can display the feed "natively"! :'(

It's a bit like saying, "the W3C says one thing but we know everyone does things differently". I'm still thinking of putting the matter on the Jooma Issue Tracker. Thanks for your reply, Per. I'm pleased to see that one person among 600,000 others has some interest in this subject.
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26121
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: J! 3.x newsfeed displays "incorrect" links

Post by Per Yngve Berg » Thu Mar 15, 2018 8:45 am

Please put it on the Issue Tracker.

As I see it, the GUID can be used to determine if the feed contains anything new. Your example contained dates added. Probably only useful to extensions importing the feed as articles, not to a feed display.

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Thu Mar 15, 2018 8:50 am

Thanks, Per. I'll do it tomorrow. :)
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Thu Mar 15, 2018 6:45 pm

A further update on this issue: I've been digging around the RSS specification (my references are http://cyber.harvard.edu/rss/rss.html and https://validator.w3.org/feed/docs/rss2.html).

The specification states that the purpose of the <guid> is
<guid> is an optional sub-element of <item>.

guid stands for globally unique identifier. It's a string that uniquely identifies the item. When present, an aggregator may choose to use this string to determine if an item is new.

Code: Select all

<guid>http://some.server.com/weblogItem3207</guid>
There are no rules for the syntax of a guid. Aggregators must view them as a string. It's up to the source of the feed to establish the uniqueness of the string.

If the guid element has an attribute named "isPermaLink" with a value of true, the reader may assume that it is a permalink to the item, that is, a url that can be opened in a Web browser, that points to the full item described by the <item> element. An example:

Code: Select all

<guid isPermaLink="true">http://inessential.com/2002/09/01.php#a2</guid>
isPermaLink is optional, its default value is true. If its value is false, the guid may not be assumed to be a url, or a url to anything in particular.
This last point is important because J! 3.x uses <guid> to construct the URLs for each <item> within in the feed.

The specification for <link> states [that this should be used for]
The URL of the item

Code: Select all

<link>http://www.nytimes.com/2002/09/07/movies/07FEST.htm<link>
J! 3.x does not use <link> element to construct the URLs for each <item> within the feed.

I conclude that this is a design flaw of the News Feed (single) view in J! 3.x, viz. lines 94-95 of /components/com_newsfeeds/views/newsfeed/tmpl/default.php

Code: Select all

		<?php $uri   = !empty($this->rssDoc[$i]->guid) || $this->rssDoc[$i]->guid !== null ? trim($this->rssDoc[$i]->guid) : trim($this->rssDoc[$i]->uri); ?>
		<?php $uri   = strpos($uri, 'http') !== 0 ? $this->item->link : $uri; ?>
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Thu Mar 15, 2018 8:07 pm

https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
pmleconte
Joomla! Explorer
Joomla! Explorer
Posts: 411
Joined: Fri Mar 17, 2017 12:55 pm
Location: France

Re: J! 3.x newsfeed displays "incorrect" links

Post by pmleconte » Mon Mar 19, 2018 2:19 pm

Hi Sozzled,

Did you notice that, in mod_feed, default.php is doing it the opposite way ? line 93 contains

Code: Select all

$uri   = (!empty($feed[$i]->uri) || $feed[$i]->uri !== null) ? trim($feed[$i]->uri) : trim($feed[$i]->guid);
"uri" is created by FeedFactory from your rss link field.

If "link" exists, no matter what it contains (if it contains something), take it, otherwise take "guid".

I use the same code in one module and everything seems to work fine.

Pascal
If anything can go wrong, it will.
https://www.conseilgouz.com/en

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Mon Mar 19, 2018 8:15 pm

Thanks for your reply. It might help if you could contribute your knowledge to https://issues.joomla.org/tracker/joomla-cms/19919.

The Joomla bugsquad have not replied to this. Any ideas would help, I think. Regardless of what it should be, in my opinion I believe that the Joomla single item feed display is broken and it's been broken for a long time ... possibly for years.
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Mon Jun 11, 2018 7:56 pm

See follow-up at https://github.com/joomla/joomla-cms/pull/20717
sozzled wrote:I've got a problem with most of the news feeds that my client wants but here is one example. This is the URL of the feed: https://www.copybook.com/military/rss/news.xml

The problem comes about when you add the menu item linked to this feed. Yes, it displays a lovely list of news items (and images) but the links on the J! 3 website are all wrong. The links use the guid information.
The changes (in four files) in GitHub #20717 fix this problem and, even better, they don't wreck news feeds that worked! 8)

A big thank you to @SharkyKZ for looking into this matter and making all those changes that have meant that those RSS news feeds that have been broken for [at least] the past five years with J! 3.x are now working again.
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Tue Jun 12, 2018 9:29 pm

When the changes have been committed into the next release of J! 3, this topic can be marked as "solved".
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 8013
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: J! 3.x newsfeed displays "incorrect" links

Post by sozzled » Tue Jun 26, 2018 8:42 pm

All fixed with J! 3.8.10. Thanks
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)


Post Reply

Return to “General Questions/New to Joomla! 3.x”