/
Write
Start a team blog
NEW ✨
Start a team blog, invite your team, and start publishing.

Transform content w/ gatsby-source-graphql

Christopher Geary's photo
Christopher Geary
·May 5, 2020

How do you transform content from gatsby-source-graphql?

I have a number of fields that contain absolute URLs to content with my CMS. Let's say hypothetically my CMS lives at https://cms.example.com and my website is at https://example.com. All of the content that comes from the CMS over GraphQL has cms.example.com as part of the absolute URL, but this is incorrect once it ends up within Gatsby.

I've seen that other plugins have ways to modify data, the Remark plugin has "plugins", and the WordPress plugin has "normalisers". Each let you "hook in" and make changes to the data before it's stored. Is that possible with the GraphQL plugin?

Is there any way to search & replace links in the content with Gatsby (without doing it inside React components).