DEV Community

Discussion on: Adding Comments to Gatsby with Netlify Serverless Functions + GitHub

Collapse
 
jon_fm profile image
Jon Sullivan

Super interesting concept. I've used Netlify a lot recently too (Gatsby/Jekyll/others) and agree that their DX is actually fantastic.

I like that this ultimately means comments are rendered statically for any given post/page you execute this methodology on, but for sure see that the build time could stack up quickly and that's especially tough for larger Gatsby sites since Gatsby build times can get really rough when your site is larger.

This idea does spark some other interesting ideas for me though. Yes, ultimately looking at dynamically fetching comments rather than having them 'baked in' but what if you jus thad a separate repo for the site's comments and operated a similar workflow - loading the page would hit a serverless function to GET the comments, which would read a corresponding JSON file out of the <repo-name>-comments repo, then posting back would just update that JSON file too. Effectively still using GitHub as a database for comments but operating comments dynamically in order to not hammer builds on your site and keep them 'separate' to some degree 🤔

Just thinking out loud. Great idea. Great concept! Good stuff :)

Collapse
 
healeycodes profile image
Andrew Healey

Hi Jon!

Thanks for your comment. Your idea of a second repository is very interesting — some cool trade offs.

I agree with you re: build times!