Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Multiple categories for a post? #77

Open
ShawonAshraf opened this issue Jan 19, 2019 · 5 comments
Open

Multiple categories for a post? #77

ShawonAshraf opened this issue Jan 19, 2019 · 5 comments

Comments

@ShawonAshraf
Copy link

ShawonAshraf commented Jan 19, 2019

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?

@baobabKoodaa
Copy link
Contributor

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?

@baobabKoodaa
Copy link
Contributor

Ok, looks like I got it now. Here is a commit in my fork: baobabKoodaa/blog@adeebb7

@ShawonAshraf
Copy link
Author

Are you sure just changing the graphql queries won't solve this? I was tinkering with the queries, yet to reach a conclusion!

@baobabKoodaa
Copy link
Contributor

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.

@sulimanalruz
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants