shuding / nextra

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

Search + custom theme #1435

Open irangarcia opened 1 year ago

irangarcia commented 1 year ago

Is it possible to use the Nextra search with a custom theme? It looks for me that the component is inside the nextra-theme-docs

fuma-nama commented 1 year ago

Yes, You might use libraries such as flexsearch to add a search to your own theme, they have an official implementation in the docs theme

But it will be great if it's a built-in feature of Nextra core There's also a pull request about rewriting the search algorithm

dimaMachina commented 1 year ago

we could export <Search /> and <Flexsearch from nextra/components and maybe rename Flexsearch to something other

shuding commented 1 year ago

Also we can write docs for the search index file format, so you can do anything with it :)

abMarlim commented 1 year ago

we could export <Search /> and <Flexsearch from nextra/components and maybe rename Flexsearch to something other

@B2o5T There is some part in the DOC where we can consult a list of components that can be exported. I notice that there are specific components in nextra-theme-docs and nextra/components (I'm a little confused by the differences), it would be interesting to have somewhere in the documentation some section on this point.

And, can the exported components be "customized" (Something similar to docusaurus swizzling)?

Thank you very much :)

dimaMachina commented 1 year ago

nextra/components contain components that are used in nextra-theme-docs and nextra-theme-blog, feel free to add it to docs

And, can the exported components be "customized" (Something similar to docusaurus swizzling)?

it depend from component, some are customizable like <Callout />, some - not

dmarkbreiter commented 1 year ago

And, can the exported components be "customized" (Something similar to docusaurus swizzling)?

it depend from component, some are customizable like <Callout />, some - not

It would be nice to see a list of customizable components, much like the output of docusaurus npm run swizzle -- --list or in nextra's documentation.

kurisubrooks commented 1 year ago

we could export <Search /> and <Flexsearch from nextra/components and maybe rename Flexsearch to something other

I'm trying to add a big search bar to the middle of the homepage (using nextra-theme-docs) but as it's not exported currently it doesn't seem possible without either editing the theme or re-implementing search (which seems like a bad idea), so I'd really appreciate this as a feature.