Zola: JSON Feed Option

Created on 31 May 2018  Ā·  11Comments  Ā·  Source: getzola/zola

Enhancement/feature request

I see RSS feed generation and there are plans for Taxonomy RSS feeds as well, but I like to build JSON feeds for my sites sometimes too. I have accomplished this with other static site generators (Hugo) by making a special template that essentially prints JSON. It's a little messy but it gets the job done. Having something like that out of the box would be a cool feature! Is it on the roadmap at all?

Perhaps the JSON Feed spec would be a good place to start. https://jsonfeed.org/version/1

If it's not in the works, I might have some time to take a stab at it in the coming weeks :)

help wanted

All 11 comments

I had never heard of JSON feed before but it shouldn't be too hard to add I assume: add a rss.json template in the default tera instance that gets the same data as the rss.xml one and render it.

I believe it would also need a special filter to escape JSON no? If so it might be worth adding it to Tera directly rather than just Gutenberg since it seems quite common

And feel free to do it! I haven't released Tera 0.11.8 yet so I can sneak a json_escape in it if needed

Thanks for the pointers! I haven't had time to dig in and make sense of anything yet, but I should have some tonight. I'll see what I can come up with! I have one of my Hugo sites almost ported over to Gutenberg so the test bed is almost ready 😈

it shouldn't be too hard to add I assume: add a rss.json template in the default tera instance that gets the same data as the rss.xml one and render it.

Could we maybe think of a more generic way of having custom output formats with themable templates? RSS, Atom, ActivityStreams, JSON Feed… There's so many different use-cases :o

Custom output formats with proper feeds support (with pagination available ¹) would be amazing. Should i open a separate ticket?

EDIT: Also related #293, a request for custom JSON templates aimed at client-side processing (i.e. in single-page applications).

This is a great idea. It might make more sense to be its own ticket -- if @Keats is on board, I say I just close this one out.

I am still interested in contributing...hopefully the ever-elusive free-time comes soon :)

Can I close this in favour of #365 or am I understanding it wrongly?

Yeah, it looks like the #365 is a more robust solution to the problem I'd like to solve. I'll go ahead and close it now :D

Just wondering, has anything happened on the JSON Feed front? As far as I can see, nothing has been talked about on https://zola.discourse.group/, and no PRs have been merged. The most optimal solution, as far as I can see, is to expose all the data needed for a RSS or JSON feed to terra templates, provide some way to escape JSON and XML and leave people to it, but I’d love some out-of-the box way to do it, for example through a config option (preferably enabled by default).

to expose all the data needed for a RSS or JSON feed to terra templates

I believe that's precisely what we were discussing in #365. Do you agree? Once Custom Output Formats are standardized then it's merely a matter of shipping an internal default JSON feed template with zola.

Yes, I agree. However, noting appears to be happening in that thread right now, and hasn’t for a few months. I can’t find any related conversations on the discourse, apart from the ā€œassetsā€ rfc.

New features were blocked until multi-lingual sites are working. They are now in 0.6 (the next branch currently) so once this is shipped, we can have a look at it again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jjbarr picture jjbarr  Ā·  5Comments

codesections picture codesections  Ā·  5Comments

anthonychwong picture anthonychwong  Ā·  4Comments

RealOrangeOne picture RealOrangeOne  Ā·  6Comments

veldsla picture veldsla  Ā·  5Comments