shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.7k stars 1.27k forks source link

How can I use Nextra's built-in search component? 🙏🙏 #2872

Open liaoyio opened 5 months ago

liaoyio commented 5 months ago

I want to insert a search box on a custom page, but Nextra has not exported the search component in the navigation bar. How can I use Nextra's built-in search component? 🙏🙏

"nextra": "2.13.3"

image
yansusanto commented 4 months ago

I'd love to know this too

Shubham-EV commented 4 months ago

yeah me too

kadirkatirci commented 3 months ago

exactly!

kadirkatirci commented 3 months ago

https://docs.orama.com/open-source/plugins/plugin-nextra this plugin solves my issue. i fixed typing error and customized style, in my repo

Shubham-EV commented 3 months ago

https://docs.orama.com/open-source/plugins/plugin-nextra this plugin solves my issue. i fixed typing error and customized style, in my repo

can you share your repo?

kadirkatirci commented 3 months ago

https://github.com/kadirkatirci/orama-nextra-search-plugin

https://docs.orama.com/open-source/plugins/plugin-nextra this plugin solves my issue. i fixed typing error and customized style, in my repo

can you share your repo?

Shubham-EV commented 3 months ago

@kadirkatirci I am asking for a repo in which you have used it in nextra? How to use it in nextra ?

kadirkatirci commented 3 months ago

@kadirkatirci I am asking for a repo in which you have used it in nextra? How to use it in nextra ?

it is private repo. but i can help to explain how to use. as described in official page (https://docs.orama.com/open-source/plugins/plugin-nextra)

install plugin: npm install @orama/plugin-nextra

import to your mdx file: import { OramaSearch } from "@orama/plugin-nextra";

use as a component: <OramaSearch />

that's all. here is the my page, you can see live: https://personellerim-docs.vercel.app/

i took and altered it because i got error. maybe you will not need to change. if you get type error you can check my repo

Shubham-EV commented 3 months ago

Are you using orama search bar in your website? It looks like nextra default search bar?

kadirkatirci commented 3 months ago

the search bar where in homepage is orama. orama uses "built-in Nextra API to automatically generate the search index depending on the current locale"

Shubham-EV commented 3 months ago

It is not working in nextra 3. Are you using nextra 2?

kadirkatirci commented 3 months ago

It is not working in nextra 3. Are you using nextra 2?

yes, "nextra": "^2.4.2", "nextra-theme-docs": "^2.4.2",

Shubham-EV commented 3 months ago

It is not working in, "nextra": "^3.0.0-alpha.24", "nextra-theme-docs": "^3.0.0-alpha.24",

Can you test this in this version?

Mike-Logit commented 2 months ago

Same. I'd like to be able to customise a lot with the search component but it's very tightly encapsulated and untouchable it seems.

I want to add callbacks to search results, to modify the search behaviour to rank pages higher than others, and add the component to the home page as well. There's a lot to be desired with that component...