Skip to content

Can't parse document when auth is added in Root.js  #187

@biboc

Description

@biboc

If I add an auth in src/theme/Root.js, search-local can't parse meta data:

[ERROR] Error: The `docusaurus_tag` meta tag could not be found. Please make sure that your page is wrapped in the `<Layout>` component (from `@theme/Layout`). If it is, then this is a bug, please report it.

src/theme/Root.js:

export default function Root({children}) {
  const [isConnected, setIsConnected] = useState(false); // Manage authentification

  return <>{
    isConnected ? (
      <>{children}</>
    ) : (
      <div className="login">
        <div className="login__container">
          <button className="login__btn" onClick={() => setIsConnected(true)}>
            Login
          </button>
        </div>
      </div>
    )
  }</>;
}

Could I first build the index in dev env without authentification and then build in prod and use the index generated previously?
Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions