Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Head's title renders with "<!-- -->" in title on first render #3738

Open
keyserj opened this issue Nov 25, 2024 · 0 comments
Open

Head's title renders with "<!-- -->" in title on first render #3738

keyserj opened this issue Nov 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@keyserj
Copy link

keyserj commented Nov 25, 2024

Describe the bug

Ran into an issue using the useConfig hook for head() - when I tried to use code like this in the theme config file:

  head: function Head() {
    const config = useConfig();

    return (
      <>
        <title>{config.title} | Site Name</title>
      </>
    );
  },

My title initially loaded as e.g. Introduction<!-- --> | Site Name for a moment before re-rendering without the odd <!-- -->:

chrome_2024-11-25_14-53-31.mp4

I followed the code for the nextra site itself exactly by extracting a title variable, like so:

  head: function Head() {
    const config = useConfig();
    const title = `${config.title} | Site Name`;

    return (
      <>
        <title>{title}</title>
      </>
    );
  },

No idea why these would be different, but this works without the issue. Really easy fix so not sure if this is worth a bug report but I thought it'd be worth documenting in an issue here at least, in case others have the issue in the future.

Reproduction

I deployed my changes to a branch:

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome 130.0.6723.117 (Official Build)
  • Version: nextra/nextra-theme-docs 3.2.4
@keyserj keyserj added the bug Something isn't working label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant