-
Configurar o plugin gatsby-source-graphql.
gatsby-config.js
module.exports = { siteMetadata: { title: `My BLog`, siteUrl: `https://www.yourdomain.tld` }, plugins: [ "gatsby-plugin-styled-components", { resolve: "gatsby-source-graphql", // library options: { // Arbitrary name for the remote schema Query type typeName: "blog", // Field under which the remote schema will be accessible. You'll use this in your Gatsby query fieldName: "blog", // Url to query from url: "https://api-us-west-2.graphcms.com/v2/ckswablvp0pvy01z5ew7ths5e/master", // url da api graphCMS }, }, ] };
-
Criar o template que receberá os dados dinâmicos
O arquivo de template fica em /src/components/PostTemplate.js
-
Gerar páginas dinamicamente no build.
Toda a configuração do build está no arquivo gatsby-node.js
-
Visitar Páginas.
1 - npm run develop 2- Acesse localhost:8000/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
1STi/gatsby-blog-example
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A Gatsby + GraphCMS Blog Example
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published