shuding / nextra

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

Nextra site search input not working #1631

Closed temtechie closed 1 year ago

temtechie commented 1 year ago

PLease how can i make the nextra search input to start working I was thinking this search has already been implemented?

dimaMachina commented 1 year ago

see examples folder or docs folder that points to nextra.site

temtechie commented 1 year ago

@B2o5T the search input is not still working, please can you make it clearer how to get it working

dimaMachina commented 1 year ago

please provide reproduction

temtechie commented 1 year ago

I learnt I do not have to make any special configuration or setting to have the search input working I was told nextra serach input works automatically after creating the nextra site

set attached images

error-on-search failed-to-load

dimaMachina commented 1 year ago

Sorry it’s not helpful, closing until you provide reproduction

temtechie commented 1 year ago

@B2o5T steps taken to create the nextra site I have an existing full stack next.js application I have cd into my pages directory and created a nextra site that lives inside the pages/docs

I have created different mdx files which works fine and also configured the next.config.js and the theme.config.js

`import React from 'react';

export default {
  logo: <span>example</span>,
  project: {
    link: 'example',
    icon: <span>🇳🇬</span>,
  },
  useNextSeoProps() {
    return {
      titleTemplate: 'example',
    };
  },
  sidebar: {
    titleComponent: ({ title }) => {
      if (title === 'docs') {
        return <>example</>;
      }
      return title;
    },
  },
  docsRepositoryBase: 'examplei',
  footer: {
    text: <span>
      © {new Date().getFullYear()} <a href="example" target="_blank">example</a>.
    </span>,
  },

  head: (
    <>
      <link rel="apple-touch-icon" sizes="180x180" href="/assets/favicon/apple-touch-icon.png" />
      <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon/favicon-32x32.png" />
      <link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon/favicon-16x16.png" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <meta property="og:title" content="Igbo API Documentation" />
      <meta property="og:description" content="Technical documentation for the Igbo API" />
    </>
  ),
  chat: {
    link: '',
    icon: <svg width="24" height="24" viewBox="0 0 248 204"><path fill="currentColor" d="M221.95 51.29c.15 2.17.15 4.34.15 6.53 0 66.73-50.8 143.69-143.69 143.69v-.04c-27.44.04-54.31-7.82-77.41-22.64 3.99.48 8 .72 12.02.73 22.74.02 44.83-7.61 62.72-21.66-21.61-.41-40.56-14.5-47.18-35.07a50.338 50.338 0 0 0 22.8-.87C27.8 117.2 10.85 96.5 10.85 72.46v-.64a50.18 50.18 0 0 0 22.92 6.32C11.58 63.31 4.74 33.79 18.14 10.71a143.333 143.333 0 0 0 104.08 52.76 50.532 50.532 0 0 1 14.61-48.25c20.34-19.12 52.33-18.14 71.45 2.19 11.31-2.23 22.15-6.38 32.07-12.26a50.69 50.69 0 0 1-22.2 27.93c10.01-1.18 19.79-3.86 29-7.95a102.594 102.594 0 0 1-25.2 26.16z" /></svg>,
  },
};

above is my theme.config.js

after all the setup the search input does not work . it throws the error on the images when you type in the search input to search on the nextra site

dimaMachina commented 1 year ago

Please provide a runnable reproduction

abhaytalreja commented 1 year ago

@temtechie I reproduced this issue. The problem is with the locale. It happened to me when I removed different locales.

Make sure that your theme.config.tsx doesn't have any i18n tag. I am assuming, you are just doing your site in English

Make sure that your next.config.js doesn't have any i18n tag.

Let me know if it works.

temtechie commented 1 year ago

@abhaytalreja my website uses i18next for language changing. i run two languages on the website

abhaytalreja commented 1 year ago

@temtechie Then make sure you do all four steps mentioned here - https://nextra.site/docs/guide/i18n

if possible, share your repo. I can take a quick look.

I had 3 languages and then removed 2 languages. That is when i started facing this issue.