Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ajayns opened this issue Feb 23, 2018 · 5 comments
Closed
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@ajayns
Copy link
Contributor

ajayns commented Feb 23, 2018

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?

@fk fk added type: question or discussion Issue discussing or asking a question about Gatsby API/Plugins labels Feb 23, 2018
@CanRau
Copy link
Contributor

CanRau commented Feb 24, 2018

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 ^^

@KyleAMathews
Copy link
Contributor

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.

@ajayns
Copy link
Contributor Author

ajayns commented Feb 25, 2018

@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 ajayns closed this as completed Feb 25, 2018
@marbiano
Copy link
Contributor

marbiano commented Mar 7, 2018

@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.

@YannickLeRoux
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

6 participants