Settings

Theme

Use Netlify Functions and the Twitter API v2 as a CMS for Your Gatsby Blog

paulie.dev

56 points by pauliescanlon 5 years ago · 21 comments

Reader

earthboundkid 5 years ago

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.

  • pauliescanlonOP 5 years ago

    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.

earthboundkid 5 years ago

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.

colesantiago 5 years ago

Not sure if using 3rd party services for a CMS is a good idea. What happens if this API or Netlify goes down?

Doesn't seem reliable.

  • bmelton 5 years ago

    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)

    • pauliescanlonOP 5 years ago

      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.

  • gamedevtales 5 years ago

    You are always relying on a 3rd party somewhere down the stack that's not a reason to dismiss a solution alone.

    • colesantiago 5 years ago

      Given Twitter's track record on APIs, there is every reason to dismiss this solution.

      • developerdylan 5 years ago

        To be fair, this is something they've acknowledged and committed to working on for future API iterations.

    • ThePadawan 5 years ago

      I can host a blog such that it only requires 2nd parties:

      - My ISP

      - My power company

      • gamedevtales 5 years ago

        What would you use for DNS?

        edit: Also they're third party. 1st is you 2nd party is the customer (The blog audience).

pauliescanlonOP 5 years ago

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.

jiofih 5 years ago

How about “no”.

  • pc86 5 years ago

    How about "why not?"

    • fallat 5 years ago

      Well it depends. Do you expect your writing to be accessible in 50 years?

    • jiofih 5 years ago

      This is harnessing about 2 million lines of code in three different systems, to achieve what amounts to copy & paste text from their Twitter bio.

jblok 5 years ago

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

rammy1234 5 years ago

For my blog , i am using Github as CMS using the github API. It simply works.

  • pauliescanlonOP 5 years ago

    Yeah lovely stuff. I'm working on a similar "thing" using Octokit. I like experimenting with things that aren't supposed to be used as CMS's as CMS's

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection