Gatsby: [gatsby-source-hackernews] Does it need to rebuild everytime for new posts?

Created on 23 Feb 2018  路  5Comments  路  Source: gatsbyjs/gatsby

I was recently working with gatsby-source-hackernews plugin and I realized that all the data is queried on build and it's used as nodes in Gatsby. So for a deployment, which is supposed to update each time on reload, to show new posts, what is the method to be followed?
Or when it's called static does it mean it's not supposed to update?

question or discussion

Most helpful comment

Any ressources/tutorials regarding automatic scheduled deploys on netlify ??

All 5 comments

if i understand you correctly i would say you would need to have some more dynamic parts which fetch content on reload or whenever you want
so you build some parts statically maybe have the overall application/website statically so when the users enters the most part is already usable and then you load in the content

or, if it's not updating too often you could just build the whole thing statically and pull every now and then to check if there is anything new which you could then fetch if necessary

or you could have the whole thing rebuild automatically by a CI server on git push or similar so it'll just rebuild everything without the need for dynamic and continuous polling

hope my gibberish helps in any way ^^

The actual files that are generated are only regenerated on build.

data can be refreshed or gotten new from the client as with any web site.

If you're building a HN clone, I'd just setup your CI to rebuild the site every 5-10 minutes or so the static data is fresh.

@KyleAMathews That is the answer I was looking for. Thank you, I'm closing this issue!

P.S It would really help if you could share some guide on doing that. (I use netlify currently)

@ajayns Seems to me like you need to write a script that uses Netlify API to trigger a deploy. Then you need to run that script every 5-10 minutes, or whatever time you need in order to keep it fresh.

Any ressources/tutorials regarding automatic scheduled deploys on netlify ??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

signalwerk picture signalwerk  路  3Comments

theduke picture theduke  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

mikestopcontinues picture mikestopcontinues  路  3Comments

benstr picture benstr  路  3Comments