gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.28k stars 10.31k forks source link

Layouts with graphql queries #1589

Closed marcebdev closed 7 years ago

marcebdev commented 7 years ago

Would be awesome to try to get GraphQL queries on layouts. This way the title, author, etc. could be quickly updated in the gatsby-starter-blog for example. Where as right now you have to change the title in multiple places, with queries on layouts you could simply change the title once and it would update everywhere.

Current solutions is to make a component that can fetch this data and push it into the layout which somewhat defeats the new GraphQL design which is supposed to be a 'pull' not 'push' system.

amirhouieh commented 7 years ago

Same thought here. Just faced it. In my case I wanted to add some global SEO tags which are in common among all pages. SEO comes from DatoCms api.

craigmulligan commented 7 years ago

@amirhouieh, @Deathstroke5467 this should be added with #1503. Pull the latest gatsby and you should be good to go. There are still things to improve so if you hit anything unexpected please let us know.