emgoto / emgoto-comments

This hosts the comments for my blog, emgoto.com.
https://emgoto.com
0 stars 0 forks source link

gatsby-search/ #5

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

How to add search to your Gatsby site · Emma Goto

A search bar is a great way to make content on your Gatsby site discoverable. In this tutorial, I'll be walking you through how to add local…

https://www.emgoto.com/gatsby-search/?utterances=6033ca40f9b04da5f62d849didHxJc9dwTeCyoUemfNizzqGztoBZ0Rzd04YgCIXAb8Vw6OMlDZd0HvOhOBBsdHTjHY08JjdzFN3pLf%2B0MsJWs4GrbUfBcBLfcUAD%2BVgZAontqFw3Y5Ue9tmwks%3D

yashvekaria commented 3 years ago

Hello, I have tried to apply your solution into my blog. But when on gatsby develop it throws me an error.

success Building development bundle - 12.293s Error loading a result for the page query in "/dev-404-page/". Query was not run and no cached result was found. Error loading a result for the page query in "/". Query was not run and no cached result was found. Error loading a result for the page query in "/dev-404-page/". Query was not run and no cached result was found. Error loading a result for the page query in "/". Query was not run and no cached result was found. Error loading a result for the page query in "/404.html". Query was not run and no cached result was found.

Could you please try to help me resolve.

emgoto commented 3 years ago

@yashvekaria Sure thing - do you want to push your code to a public repo? I can take a look.

yashvekaria commented 3 years ago

The issue has been resolved. Thanks for the concern. Much appreciated.

misticvm commented 3 years ago

Could you indicate to me what should i change in the query in case of to use Strapi because i am trying with the same query that i use on gatsby-node.js but not working. It returns to me this message:

"gatsby-plugin-local-search" threw an error while running the createPages lifecycle:

Cannot read property 'map' of undefined

124 | if (documents.length < 1) 125 | reporter.warn(

126 | msg( | ^ 127 | The query for index "${name}" returned no nodes. The index and store will be empty., 128 | ), 129 | )

Regards

emgoto commented 3 years ago

@misticvm Hi! If you want to push your code to a public repo, I'd be happy to take a look.

jcgsr commented 2 years ago

Hi, Emma! Please help: I have some data on Strapi, query goes alright with GraphQL, so does the render of the data, but the searching...

Here is the repo

and here is the error message

Error in function John in ./src/pages/index.js:12 Cannot read property 'localSearchBands' of undefined

I hope you have some time to help me. Thank you in advance!

EricPhifer commented 2 years ago

Hey! Great post! It has been really helpful. Unfortunately, search seem to be my bane... something always trips me up. I'm not using the search for a blog, but it's very similar. The last GIF on this post that shows the search bringing up a different LinkComponent based on what is searched for is exactly what I'm trying to do. It's a database for a client, so I can't share the code, but if I could connect with someone to help me through I would be very grateful! Anyone able to help? :pray: