jquery-rss icon indicating copy to clipboard operation
jquery-rss copied to clipboard

How to add images and custom tag content?

Open GlenHughes opened this issue 11 years ago • 13 comments

Please see this feed: http://www.espnscrum.com/rss/rugby/rss/headlines_fantasy.rss how do we add the images and custom tags? I just get undefined when I try to load them.


$("#rss-top").rss("http://www.espnscrum.com/rss/rugby/rss/headlines_fantasy.rss", {
        limit: 3,
        tokens: {
          articlelink: function(entry, tokens) { return entry.link },
          articleimage: function(entry, tokens) { 
            if(typeof entry.image == 'undefined' || entry.image == '') {
                return 'scrum_placeholder.jpg';
            }
            return entry.image 
          },
          mainheadline: function(entry, tokens) { return entry.headline },
          articlesubhead: function(entry, tokens) { return entry.linkname }
        },
        layoutTemplate: '<ul class="news-items">{entries}</ul>',
        entryTemplate:  '<li>' +
                            '<a href="{articlelink}">' +
                                '<img src="{articleimage}" alt="{mainheadline}" width="99" height="56">' +
                                '<h3>{body}</h3>' +
                            '</a>' +
                            '<p class="description">{articlesubhead}</p>' +
                        '</li>'
    });

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

GlenHughes avatar Oct 16 '14 08:10 GlenHughes

Hm interesting. It seems that google itself is not returning the images of the feed. Will try to fix it

sdepold avatar Oct 18 '14 12:10 sdepold

Great thank you.

GlenHughes avatar Oct 18 '14 13:10 GlenHughes

I think the reason for the issues is actually the fact that the feed is invalid http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.espnscrum.com%2Frss%2Frugby%2Frss%2Fheadlines_fantasy.rss

sdepold avatar Oct 18 '14 20:10 sdepold

I'm working on a self-written feed parser which results in something like this: http://jquery-rss-feedr.herokuapp.com/entries?url=http://www.espnscrum.com/rss/rugby/rss/headlines_fantasy.rss. To be clear: The feed is still invalid and it seems that image is not valid inside item. Anyways, the parser will allow to add the original item data to the result and therefore make the data available. The fix will maybe available tomorrow.

sdepold avatar Oct 19 '14 20:10 sdepold

Hi,

Thanks a lot for all of your help. Okay that makes sense and after reading this: http://feedvalidator.org/docs/howto/declare_namespaces.html it seems the feed is wrong as pointed out.

I will contact the feed creator and get that updated.

Kind regards

GlenHughes avatar Oct 20 '14 08:10 GlenHughes

I managed to get the feed fixed on their end and it is now working fine. I need to load the first 3 items in one place and then load another 3 below after an advertisement.

Is it possible to add a offset?

GlenHughes avatar Oct 21 '14 11:10 GlenHughes

If that is not stated in the docs, then it's not supported. Sorry!

Von meinem iPhone gesendet

Am 21.10.2014 um 13:33 schrieb Glen Hughes [email protected]:

I managed to get the feed fixed on their end and it is now working fine. I need to load the first 3 items in one place and then load another 3 below after an advertisement.

Is it possible to add a offset?

— Reply to this email directly or view it on GitHub.

sdepold avatar Oct 24 '14 18:10 sdepold

Okay fair enough. I'm going to be coding that into it so you are more than welcome to add it as you wish.

Glen Hughes www.glenhughes.me LinkedIn: www.linkedin.com/in/glenhughesuk M:+447956637953

On 24 Oct 2014, at 19:25, Sascha Depold [email protected] wrote:

If that is not stated in the docs, then it's not supported. Sorry!

Von meinem iPhone gesendet

Am 21.10.2014 um 13:33 schrieb Glen Hughes [email protected]:

I managed to get the feed fixed on their end and it is now working fine. I need to load the first 3 items in one place and then load another 3 below after an advertisement.

Is it possible to add a offset?

— Reply to this email directly or view it on GitHub. — Reply to this email directly or view it on GitHub.

GlenHughes avatar Oct 24 '14 18:10 GlenHughes

Sure, sounds good!

sdepold avatar Oct 24 '14 19:10 sdepold

Hello, Im using this plugin in my website, and also having the same problem of displaying images in the feed... So I tried out what Hughes did but still no image is being displaed, do u have any idea why is it beahing so??

abdallahmayuto avatar Mar 22 '15 14:03 abdallahmayuto

@AbdallahMyuto did you check that the feed is valid? Which feed URL is that?

sdepold avatar Mar 23 '15 05:03 sdepold

yes i checked it's valid

abdallahmayuto avatar Mar 24 '15 20:03 abdallahmayuto

Again: Which feed URL is that?

sdepold avatar Mar 28 '15 19:03 sdepold