Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Display RSS from another site in Grav

Started by Muut Archive 9 years ago · 18 replies · 1584 views
9 years ago

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

9 years ago

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.

9 years ago

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.

9 years ago

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?

9 years ago

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
9 years ago

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.

9 years ago

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.

9 years ago

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).

9 years ago

Good idea. Many thanks. For everything.

9 years ago

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.

9 years ago

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.

9 years ago

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.

9 years ago

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)?

9 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1346 9 years ago
Archive · by Muut Archive, 9 years ago
2 933 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2945 9 years ago
Archive · by Muut Archive, 9 years ago
3 1117 9 years ago