Getting read time from api call to post

Hey all :slight_smile:

Is there a way to get the total read time of a post through the Ghost v2 api?

Thanks in advance.

Hey!

There isn’t no, but there’s plenty of third party packages that can help you with that :)

Here’s one: reading-time - npm

1 Like

If you’re using the API in JavaScript, we have a helper that can calculate it for you:

https://docs.ghost.org/api/javascript/sdk/#reading-time

This is the same code used to calculate it in the {{reading_time}} handlebars helper. This code is currently at the SDK level, rather than the API level, because it’s a little intensive. If there’s a lot of request to move it up the the API layer, we can look at doing this in an optimal way.

3 Likes

Ohhh I assumed that it was calculated on post publish/update and stored somewhere. I’ll look into using the helper. Appreciate the quick replies from you and @egg :]

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.