However, I can’t find a way to convert automatically my RSS feed to JSON.
The website you suggested is only for one-time process, whereas I would like that every time a post appear in my RSS feed, it gets automatically converted to a blog post in my hugo blog.
However, what I’m trying to achieve is not to import the feed of a Hugo blog inside an other Hugo blog.
What I want is
to take the RSS feed, for example of my Shaarli bookmarks, or of a Wordpress website (where I do not have the authority to install a Json plugin),
and display these posts in my Hugo blog.
Since you want the content from a RSS feed to automatically be added to Hugo and Hugo generates static sites, you’ll need some kind of automatic that’s outside of Hugo, such as a crontab entry to re-run hugo.
Given that requirement, rather than modify hugo to have the ability to parse an RSS feed directly, it would be simpler and more straight forward to simply schedule an repeating task that would parse the RSS feed into JSON or another data format, and place the output where hugo will pick it up on the next run.
So for example:
Scheduled every hour/day/etc:
a script or program that converts RSS to JSON, using as input source your bookmarks, and outputting to your hugo data/ directory.
You were originally asking about Data Templates, so if you wanted to go that way still then simply direct the output to your hugosite/data/ folder and access it via a hugo template.
In the unix world, if any program of script outputs to the screen, you can redirect that output to a file. The following save a directory listing to a txt file instead of printing to the console:
ls -la > listing.txt
But the specific method would depend on the tool you choose to use, and what options it includes.
Since it’s outside Hugo, it’s less likely that someone here will know how to use it any more than you do. Once you find a tool you want to use, then you’d need to check their documentation, and the best place for help would be on their forums etc.
If I was looking for a small standalone utility to download rss and output some json on a unix type system, I’d look at python or perl first, since both are common utility scripting languages. You’d need to decide what is best for your situation.
Okay, many thanks for your answer. It’s true I dismissed a bit too quickly Perl and Python, as I want to use docker, I went directly for Node or Go.
I will try with a little script then.
If I can’t make it work, I will see if I can use one of the few “RSS to Markdown” converter i found.