prismicio / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
17 stars 14 forks source link

Readingtime of a page #29

Closed ohlr closed 4 years ago

ohlr commented 4 years ago

I tried this plugin to calculate readingtime serverside but as this plugin apparently uses schema stiching this isn't possible.

https://github.com/moonmeister/gatsby-plugin-readingtime/issues/4#issuecomment-663630157

Any ideas how to compute readingtime server side?

MarcMcIntosh commented 4 years ago

Good question, we're aware of the schema stitching issue.

Are you trying to implement incremental builds?

ohlr commented 4 years ago

nah, I simply wanted to add an estimate for readingtime to my blogposts...

ohlr commented 4 years ago

I'm using the following client side code now:

    let allText = "";
    main?.body?.map((slice) => {
        if (slice.type === "text") {
            allText += RichText.asText(slice?.primary?.text) + " ";
        }
    });
    const timeToRead = readingTime(allText);

Still would be cool to obtain this via graphql - serverside