Nikola Đuza
Aug 14, 2020 ⋅ 13 min read

Creating a Gatsby blog from scratch

Nikola Đuza Nikola is an engineer and a writer who lives and works in Novi Sad, spreading knowledge to folks through blogging and talking. He likes to build awesome things with mostly JavaScript and Ruby. You can find out more about him on pragmaticpineapple.com.

Recent posts:

Using Defer In Angular 17 To Implement Lazy Loading

Using defer in Angular 17 to implement lazy loading

Angular’s new `defer` feature, introduced in Angular 17, can help us optimize the delivery of our apps to end users.

Lewis Cianci
Dec 4, 2023 ⋅ 10 min read

Using ElectricSQL to build a local-first application

ElectricSQL is a cool piece of software with immense potential. It gives developers the ability to build a true local-first application.

Rahul Padalkar
Dec 1, 2023 ⋅ 11 min read
Using Rust And Leptos To Build Beautiful Declarative User Interfaces

Using Rust and Leptos to build beautiful, declarative UIs

Leptos is an amazing Rust web frontend framework that makes it easier to build scalable, performant apps with beautiful, declarative UIs.

Eze Sunday
Nov 30, 2023 ⋅ 10 min read
5 Best JavaScript Multi-Dimensional Array Libraries

5 best JavaScript multidimensional array libraries

Learn more about the 5 best JavaScript libraries for dealing with multidimensional arrays, such as ndarray, math.js, and NumJs.

Pascal Akunne
Nov 30, 2023 ⋅ 4 min read
View all posts

7 Replies to "Creating a Gatsby blog from scratch"

  1. Great blog post. In the GraphQL at the bottom, you forgot to include the “date” field in the frontmatter.

  2. great article, small edit though, on src/pages/blog.js the h2 tag needs curly brackets i.e. {post.frontmatter.title}

  3. Sorry it did not work.
    The error says “Multiple “root” queries found: “MyQuery” and “MyQuery”.”
    Seems the query name is conflicting between pages/blog.js and pages/index.js.
    Why does it happen?

  4. Hey, Heyo, sorry it didn’t work.

    The reason why build fails when there are two queries with the same name is because Gatsby extracts all queries and compiles them. So when there are two queries with the name – they will clash and an error will be thrown. There’s more information here https://www.gatsbyjs.com/docs/query-extraction/.

    If you take a look, we name the query inside pages/index.js as MetadataQuery and the one in pages/blog.js is MyQuery so they don’t clash.

Leave a Reply