Sign in
Log inSign up

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 cms.example.com and my website is at 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).

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct