-
-
Notifications
You must be signed in to change notification settings - Fork 875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global site/config values #20
Labels
enhancement
Improvement/enhancement of existing features
Comments
This was referenced Jan 11, 2019
Is this enhancement still of interest or did you find a better approach in the meantime? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: