What would be the best way to display the last topics excerpts and categories via the API?


(Coin-coin le Canapin) #1

Greeting.
I’m looking to display the last topics of my Discourse forum on a Wordpress website.
I’ve made a WP plugin which grabs /latest.json data and displays them to my WP users in a widget.

However, besides the title, view/reply counts and most active posters, I’d like to display an excerpt from every topic as well as their category.

I need another request for the categories, but what about the excerpts? Should I do one additional API request for every topic in order to make an excerpt?

If I want to display the 5 last topics with an excerpt and the category, that would be like 7 requests? Do you think that would slow significantly the WP page loading?


(Simon Cossar) #2

You can save the Discourse category data on WordPress so that you don’t have to keep requesting it. The same idea works for excerpts. Once you have the excerpt for a topic on WordPress, you shouldn’t need to fetch it again from Discourse.