You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Throughout the codebase we're using values that either come from the starter specific siteConfig.js, or - via Content API - the Ghost settings (like here for example, where we run a StaticQuery in order to use both sources).
Ideally those would be merged together in one site or config, so it's easily accessible by other components/modules.
The biggest pain point here is, that we need the values from the Ghost settings already in the gatsby-config.js! Because of the unavailability of the Ghost settings in this file, we had to create a workaround and adjust the gatsby-offline-manifest plugin (👉 see PR here #15)
This is due to Gatsby's specific lifecycle that allows to run GraphQL queries only after the first schema creation. This means at the point when Gatsby is processing the config file, it simply doesn't know about Ghost settings yet.
Proposal
Create a script, that runs before any Gatsby activities and fetches the data from the settings endpoint via Content API (without gatsby-source-ghost usage) and make those merged values available in gatsby-config (and ofc any other occurrences). This can be a .json file for example that get's replaced with every build.
Todos
Finalise idea for this solution. Maybe there are better ways of doing that, then the proposed way?
Implement solution
Replace all StaticQuery occurrences for allGhostSettings and use new solution
Problem description
Throughout the codebase we're using values that either come from the starter specific
siteConfig.js
, or - via Content API - the Ghost settings (like here for example, where we run aStaticQuery
in order to use both sources).Ideally those would be merged together in one
site
orconfig
, so it's easily accessible by other components/modules.The biggest pain point here is, that we need the values from the Ghost settings already in the
gatsby-config.js
! Because of the unavailability of the Ghost settings in this file, we had to create a workaround and adjust thegatsby-offline-manifest
plugin (👉 see PR here #15)This is due to Gatsby's specific lifecycle that allows to run GraphQL queries only after the first schema creation. This means at the point when Gatsby is processing the config file, it simply doesn't know about Ghost settings yet.
Proposal
Create a script, that runs before any Gatsby activities and fetches the data from the
settings
endpoint via Content API (without gatsby-source-ghost usage) and make those merged values available ingatsby-config
(and ofc any other occurrences). This can be a.json
file for example that get's replaced with every build.Todos
StaticQuery
occurrences forallGhostSettings
and use new solutionThe text was updated successfully, but these errors were encountered: