I would just make a request to Twitter for the profile on build for the two sites. Do you expect to update your profile more frequently than your two sites? ISTM, you can just trigger manual builds when you do update your profile, instead of using a function, which is going to constantly be looking up and returning the same information.
Hey, and yes that would also work, as you say, for profile information that doesn't change that often it would perhaps be the better option. However, since this is a tutorial blog post it's aim was to inform readers of "one" way you can use Twitter as a CMS. There are of course many other ways to achieve this.
Comments so far are negative, but not every solution needs to scale. I recently made a Netlify site where the CMS is just writing JSON out to GitHub. Yes, if GitHub goes down, it will break, but who cares? My site expects to only get a couple of weeks of editing every few years, so I don’t need something with more availability than that.
If the Twitter API is down, then you'll have blank spots on your page where there are supposed to be tweets.
If Netlify goes down, you won't be able to publish, but your statically rendered site should still load just fine unless you are using it to make dynamic queries on the fly (which is, I think not generally done for Gatsby, but very possible to do)
A fair point. Also true for any front end that relies on an API to populate its data. Hacker News for instance will use a similar approach. If they concern is that sometimes API's may go down and data won't be displayed you can of course chose not to use API's in your front end. If you're not that bothered like me, that this is just. "one" way you "could" use Twitter as a CMS for you blog.
In this post I'm going to explain how you can use Netlify Functions to access your Twitter profile data using the Twitter v2 API and display it on your Gatsby blog.
Seems like a great solution to streamline your personal online presence. If you don’t have a Twitter you could probably do the same thing with GitHub or Instagram