gatsby-starter-hero-blog
gatsby-starter-hero-blog copied to clipboard
Multiple categories for a post?
Currently, if I add multiple categories for a post like this, let's say
title: test author: testAuthor category: ["t1", "t2"] cover: someImage.png
I get a blank page and graphql query related error on the console. Any way around this?
This requires a lot of changes in tens of different files. I've been trying to do this for a couple of hours now and I'm currently stuck at an error that I'm unable to debug. Did you get any further with this?
Ok, looks like I got it now. Here is a commit in my fork: https://github.com/baobabKoodaa/blog/commit/adeebb767fd3e2da6312b69e2698695c2c45cd69
Are you sure just changing the graphql queries won't solve this? I was tinkering with the queries, yet to reach a conclusion!
Yes I'm sure. In addition to changing the GraphQL queries you also need to change the JS where you mangle the result of the query. We used to just get a String, now we get an array of Strings, so we need to handle it differently.
If you still need multi category support check out my fork https://github.com/SpringSuliman/gatsby-starter-hero-blog But you need to provide category as an array for all posts I couldn't get GraphQL to accept both string and array