O’Reilly Report: Decoupled Applications and Composable Web Architectures - Download Now

Empower your teams & get a 582% ROI: See Storyblok's CMS in action

Skip to main content

Announcing gatsby-source-storyblok V4

Arisa Fukuzaki
Try Storyblok

Storyblok is the first headless CMS that works for developers & marketers alike.

We'd like to announce gatsby-source-storyblok V4 has been released to improve your Storyblok x Gatsby DX🥳

We reviewed how Gatsby & Storyblok projects are handled differently from our @storyblok/react SDK and took care of the pain points to deliver less complication.

Let us know how's your DX with our gatsby-source-storyblok V4 SDK!

Special thanks to Alex for his hard & awesome collaboration work 🙏

You'll need TL;DR? You can jump directly to the LIVE DEMO in CodeSandbox right away.


First things first, install gatsby-source-storyblok by running the command below.

      npm install gatsby-source-storyblok
// yarn add gatsby-source-storyblok


Next step, register the plugin on your application and add the access token from your Storyblok space.


i.e. You can initialize just once in components/layout.jsx if you use gatsby-source-storyblok for your Gatsby projects.

If you would like to use the Storyblok API Client, you can add apiPlugin.

      import { storyblokInit, apiPlugin } from "gatsby-source-storyblok";
import Page from "./components/Page.jsx";
import Teaser from "./components/Teaser.jsx";

  accessToken: "YOUR_ACCESS_TOKEN",
  // bridge: true,
  use: [apiPlugin],
  components: {
    page: Page,
    teaser: Teaser,

Did you realize something?😎

You don't have to handle conditionally returning components by yourself anymore!

We took care of all and you just need to add all your components to the components object in the storyblokInit function, and that's it!

Query Storyblok API and listen for Visual Editor changes

You can use the convenient useStoryblokState(originalStory, bridgeOptions) hook to get the story from the Storyblok CDN API, and automatically use Storyblok Bridge to listen for the Visual Editor live changes.

      import { useStoryblokState } from "gatsby-source-storyblok"

import Layout from "../components/layout"

const IndexPage = ({ data }) => {
  let story = data.storyblokEntry
  story = useStoryblokState(story)

  return (

export default IndexPage

export const query = graphql`
  query HomeQuery {
    storyblokEntry(full_slug: { eq: "home" }) {

Link your components to Storyblok Visual Editor

For every React component, you want to link to its corresponding Storyblok component, you can use storyblokEditable function with the blok content where blok is the actual blok data coming from Storyblok's Content Delivery API

      import { storyblokEditable } from "gatsby-source-storyblok";

const Feature = ({ blok }) => {
  return (
    <div {...storyblokEditable(blok)} key={blok._uid}>

export default Feature;

Then the <StoryblokComponent blok={blok} /> will take care of loading them for you 😉.



TL;DR: Play with the Gatsby demo

Next Steps

Want to contribute? You can create an issue or PR on the Gatsby SDK repo or get in touch.