Js-Search and Routing
See original GitHub issueHello,
I have implemented js-search on my site, it works correctly and I am having a lot of fun https://github.com/gatsbyjs/gatsby/blob/master/docs/docs/adding-search-with-js-search.md
I have added the link tag on each element of the research, I am trying to implement routing but without success:
...
createPage({
path: `/page-2/${data.id}`,
component: path.resolve(`./src/templates/ClientSearchTemplate.js`),
context: {
bookData: {
allBooks: data,
options: {
indexStrategy: `Prefix match`,
searchSanitizer: `Lower Case`,
TitleIndex: true,
AuthorIndex: true,
SearchByTerm: true,
},
},
},
})
....
...
{queryResults.map(item => {
return (
<Link key={item.id} to={`/page-2/${item.id}`}>
<tr key={`row_${item.id}`}>
<td
style={{
fontSize: "14px",
border: "1px solid #d3d3d3",
}}
>
{item.id}
</td>
<td
style={{
fontSize: "14px",
border: "1px solid #d3d3d3",
}}
>
{item.title}
</td>
<td
style={{
fontSize: "14px",
border: "1px solid #d3d3d3",
}}
>
{item.body}
</td>
</tr>
</Link>
)
})}
...
I’m stuck and not able to go on, I think I miss the structure of the page-2.js file, I don’t understand how it should be implemented.
Anyone have an opensource example I can learn from? I understood the mechanism using graphql, but in this case without graphql I don’t know how.
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Create a route with “search url” as parameter using Express.js
Routing : Routing in-network means filtering out the desired path from the bulk of paths available in the computer networks or the server....
Read more >Express routing GET with search params - node.js
The question is: How can I map those urls properly in Express, in a way to redirect each route to the corresponding method?...
Read more >Sync your URLs with InstantSearch.js - Algolia
This guide focuses on storing the UI state in the browser URL. This guide goes through different ways to handle routing with your...
Read more >Chapter 7: Searching - Eloquent JavaScript
The route will be kept as an array of names, and when arriving at a new place, the algorithm calls member to check...
Read more >Express Tutorial Part 4: Routes and controllers - MDN Web Docs
First we create routes for a wiki in a module named wiki.js. The code first imports the Express application object, uses it to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ubuntutest no need to thank whatsoever, just glad that i was able to help you as much as i could. And don’t worry about it, just keep practicing and reading at your own pace and in no time you’ll be more than able to build awesome stuff either with Gatsby or React in general. One thing that the Gatsby excels is for easy to follow and extremely comprehensive, covering a lot of topics. Circling back to the documentation and looking at it now, probably i could have made a more advanced case and could have added it, for that mishap i’m trully sorry.
@LekoArts no problem whatsoever, i’m glad that you’re actively working on new processes to triage issues and a better place for questions like for instance this one. And like i mentioned to @ubuntutest no need to thank, just glad that i was able to help him solve his issue.
Both of you stay safe.
@jonniebigodes Thanks for pointing this out and sorry to @ubuntutest if that made you feel uncomfortable. We’re currently trying out new processes around issue triaging and in this instance I should have followed another route and asked for more information first. We’re also working on a better place for questions than on GitHub but until then I’ll take extra care to think about this. Thanks for the lengthy explanation and thanks for using Gatsby! 😃