Posted on: 29 October 2020Static Site Deployments with Webhooks
Previously on my personal website, the blog content, after converting it back to Static Site Pages, I figured out that you can use webhooks to trigger rebuilds. As both Vercel (the hosting provider) and Prismic (the headless CMS provider) have support for webhooks. To do this, we are going to try and trigger a build on the creation and deletion of blog-posts documents.
Firstly, we go into our Vercel project and create a new webhook, to do this:
- Go into Settings in your vercel project
- Click on Git in the sidebar
- scroll down to Deploy Hooks
- Fill in the blanks (I named my hook Prismic (Production) and had it target my production branch which is main), then click create.
Now copy the webhook URL into your prismic screen (under Settings → Webhooks), give it a name and paste the URL. then hit Add this webook!
Now you should be able to trigger it, try it out and look under your Deployments tab in Vercel to make sure it works.
And there we have it, static page generation (hopefully) for blogs using NextJS, Vercel and Prismic (with Webhooks!)
Following a discussion on Twitter with @timneutkens, you dont need to use webhooks as of NextJS v10. All you need to do is add fallback: blocking to your getStaticPaths response.
You don't have to add a webhook, you can also add `fallback: 'blocking'` to getStaticPaths and it'll automatically render page when you add it to the CMS!— Tim (@timneutkens) October 29, 2020
Migration of Live/Music
A few days ago whilst browsing through my old repositories on GitHub, I've discovered a really old app which showcased chaining some really awesome technologies together. This app showed what music I was playing anytime on Spotify or iTunes via Last.fm.
October 2020 Site Upgrades
Something happened to my blog but you can't really tell if you visit the frontend of my blog! I migrated all my blog posts over to Prismic as a Headless CMS solution, after finding that I prefer writing my blog content over on a rich text editor and also having to roll out a change to my preview and main branches on my repository (github.com/ericjiang97/nextjs-personal) especially with blog posts.