Open aaornrylow opened 8 years ago
are you talking about this http://wet-boew.github.io/v4.0-ci/demos/feeds/feeds-en.html ??
Yes. That's the one.
My first comment filtered it out because I used <description>
without "code" markup, but just to be clear I was talking about the RSS description field.
Any update on this issue?
Can be this closed or otherwise? Please update the status of this again, whether this remains still an issue? Thx
This is still an issue.
Any word on this? The WET3 version is currently broken (even on your site). It just shows the spinning "loading" symbol. We'd like to move to the WET4 version but it's not very practical in our context without also being able to show the description field.
2014-09-23
v4.0.6 released v3.1.15 released End of support for v3.1.x
Also WET 3 used ajax.googleapis.com which is now deprecated.
We're not asking for further support on the WET3 version. The issue is with the current WET4 feeds plugin when using it to pull from a standard RSS (XML) feed (here's the current feed on our website, for example). Unlike the WET3 version it does not have the option to display the description field from the RSS file. This field provides key info for us so we need it to display.
I'm afraid that's not easily done in WET4
@aaornrylow I understand your feature request but it might be only done for ATOM feed not RSS feed.
The ATOM feed equivalent of RSS description field is : summary
Task:
summary
if specified in the feed configuration@aaornrylow a side note. As per the Standard on Web Interoperability, Appendix B, your feed should be converted in the Atom Syndication Format (RFC4287)
@aaornrylow If changing the feed is problematic you could try:
HTML:
<section id="wb-feeds-custom-1" class="wb-feeds limit-19">
<h3>Releases Jan</h3>
<ul class="feeds-cont">
<li>
<a href="http://www.crtc.gc.ca/eng/rss/2017releases-jan.xml" rel="external">Releases Jan</a>
</li>
</ul>
</section>
Javascript:
<script>
$( document ).on( "wb-feed-ready.wb-feeds", ".wb-feeds .feeds-cont", function( event ) {
updateDescription( "#wb-feeds-custom-1", event, "http://www.crtc.gc.ca/eng/rss/2017releases-jan.xml" );
});
function updateDescription( element, events, url ) {
var limit = $( element ).attr( "class" ).match( /limit-(\d*)/ )[1];
$.ajax({
type: 'GET',
url: 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20feed%20where%20url%20%3D%20\'' + encodeURIComponent(decodeURIComponent(url)) + '\'%20limit%20' + (limit ? limit : 5) + '&format=json',
dataType: 'json',
success: function( data ) {
var listItems = events.target.getElementsByTagName('li'),
feedData = data.query.results.item;
for ( var i = 0; i < listItems.length; i++ ) {
var listItem = listItems[i],
feedTitle = listItem.getElementsByTagName('a')[0].innerHTML,
feedDataTitle,
br = document.createElement("br"),
span = document.createElement("span");
for ( var y = 0; y < feedData.length; y++ ) {
feedDataTitle = feedData[y].title;
if ( feedTitle.toUpperCase() == feedDataTitle.toUpperCase() ) {
span.innerHTML = feedData[y].description;
listItem.appendChild( br );
listItem.appendChild( span );
}
}
}
}
});
};
</script>
This is prototype (must test this yourself (I'm sure bugs exist)).
@kodecount I do not think that changing the feed is problematic. It's just that someone need to submit a pull request with the fix.
I meant more so if they need the feed change ASAP. Probably be a while till someone does this.
Yes the change is simple just need something like:
return "<li><a href='" + data.link + "'>" + title + "</a><br />" +
( data.publishedDate !== "" ? " <small class='feeds-date'><time>" +
wb.date.toDateISO( data.publishedDate, true ) + "</time></small>" : "" ) + ( data.description !== undefined && data.description !== "" ? "<br /><summary>" +
data.description + "</summary>" : "" ) + "</li>";
At Line 121-123
Thanks for this. I found one bug so far. Maybe you can help me squash it.
If you change the feed limit to display all items (there are currently 19), there are 4 items in a row near the very end that don't display their descriptions:
This is because of the condition if ( feedTitle.toUpperCase() == feedDataTitle.toUpperCase() )
.
For those 4 items, the feedTitle
and feedDataTitle
do not match.
Can you help me figure out why it would be different for only those 4 items?
Planned for the next release of WET (version 4.0.24), you will be able to achieve something similar by using the data-json plugin.
You will find a temporary working example here: http://universallabs.org/wet/labs/data-json/display-feed-issue7618/unmin/demos/data-json/feeds-layout-en.html
It will be simple as:
<div data-wb-json='{
"url": "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20feed%20where%20url%20%3D%20'http%3A%2F%2Fwww.crtc.gc.ca%2Feng%2Frss%2F2017releases-jan.xml'%20limit%2019&format=json#/query/results/item",
"mapping": [
{ "selector": "h2", "value": "/title", "placeholder": "" },
{ "selector": "a", "value": "/description" },
{ "selector": "a", "value": "/link", "attr": "href" },
{ "selector": "span", "value": "/pubDate", "placeholder": "[[pubdate]]" }
]
}'>
<template>
<h2></h2>
<p><a href=""></a> <span>Publish on [[pubdate]]</span></p>
</template>
</div>
then it render like:
That data-json plugin sounds redundant to me. If you want binding like this, shouldn't you use something like angular instead of creating a pseudo angular?
@LaurentGoderre for better recording purpose let have that discussion when I will submit the official PR. It should be submitted by next week.
@aaornrylow Once the Pull Request #7875 are merged-in, you will have more flexibility and more control on how you can layout your feed. See the Template HTML 5 working example in the pull request description.
@aaornrylow if you are using GCWeb theme, you can use the data-json plugin to do it. See the "Layout a RSS feeds" working example here: http://wet-boew.github.io/themes-dist/GCWeb/demos/data-json/template-en.html
Hi,
Is it possible to include the RSS
<description>
field in the WET4 feeds widget? It was displayed by default in the WET3 version.Thanks, -Aaron