Display RSS from another site in Grav

Is there a plugin or some other method for displaying the contents of an RSS feed in Grav?

There is not currently a plugin for grabbing external feeds, but you’d only need to integrate a RSS-parser and return a template-tag for Twig.

Thanks. “Only” is the problem for me, as I am not very skilled in this kind of thing. I remember using Magpie RSS some time ago. I guess it is time to learn some more and see whether I can do this.

There are RSS - to - widget services out there, for example https://feed.mikle.com or https://www.rssinclude.com or http://www.rssdog.com (very quick Google search, I’m sure there are better ones) that give you a little JS you can embed in a Twig template file.

Thanks. I’ll look at those too.

I may have a plugin almost complete for this purpose, but I am curious, is your use case for display the feed on a specific page or in a template-element like a sidebar?

If you’re still looking for a solution, I made a plugin: Twig Feeds, which allows you to retrieve RSS or Atom feeds and use them in Twig-templates (see Github-repo for usage instructions).

1 Like

Wow. Taking a look now. Thanks.

Thanks a million Olevik. I have it working in a rudimentary fashion on my dev instal, in a sidebar. I wanted to bring in some elements from another site, in the spirit of indieweb. I need to think more about how to display, especially for some kinds of posts, and whether to filter the posts I am bringing in. I don’t think it will get a page of it’s own at the moment. More likely a template element, either in the sidebar, where it was quite easy, or before a footer.

By the way, I tried to make a partial under /user/themes/mytheme/templates/partialsbut that didn’t work. I suppose I need to work out how to tell the theme to look there for the partial twig.

You probably need to make sure the theme is a child theme, so that theme inheritance takes place. Then any template you edit (with the same structure as the parent them) will override the parent’s template.

It is a child theme, and thanks to you I have it working, in the sidebar here https://www.jeremycherfas.net/blog

Nice-looking site, though one simple suggestion I would have is to structure the pagination so you get something like << [1] [2] [3] ... [37] >> instead of the whole range of pages from 1 to 37 with a button each (set the delta-option to something like 3 in the options of the Pagination-plugin).

Good idea. Many thanks. For everything.

I seem to be running into a problem. I clear the cache and look at the site, and everything is as I expect it. But if I return to the site a little later, that part of the sidebar is not there any more.

I expect it has something to do with caching rules, but I cannot figure out what.

Turning caching off completely solves the problem, but is obviously not ideal. Not sure which options in Configuration or possibly Cache check method to try.

None of the options under Cache check method make any difference. If caching is on, the output of the plugin is shown the first time the Sidebar is displayed, but not thereafter.

This is odd, as Grav should independently cache the results of rendered Twig-templates. Would you mind zipping up a copy of your Grav-installation (clear cache first to get rid of unnecessary files), and sending it to me via PM or or on Gitter (@OleVik)?

Sure. I’ll do that. I’ll zip my local copy, which has caching off and works perfectly when it is off.

nice