Skip to content

Configuring title of generated index.html page #1255

Closed

Description

@annorax

There is no apparent way to configure the title (i.e. the html <title>) of the generated index.html file - it eems to be hard coded to "React App".

Of course I can edit the generated file, but I'd like to fully express my app in source and have my generated files production ready right out of the box.

I assume this can be accomplished with "eject" but that seems like an overkill for what should be a very common configuration requirement.

Activity

  1. Timer commented on Dec 12, 2016

    @Timer
    Contributor

    There is no apparent way to configure the title (i.e. the html <title>) of the generated index.html file - it seems to be hard coded to "React App".

    Editing public/index.html is the proper way to configure your page's default title.

    Of course I can edit the generated file, but I'd like to fully express my app in source and have my generated files production ready right out of the box.

    The public/ directory should be checked into source control.
    build/ is the directory which should be in your .gitignore.

    I assume this can be accomplished with "eject" but that seems like an overkill for what should be a very common configuration requirement.

    Ejecting is not necessary; if you would like to mutate your title based on page check out react-document-title.


    Of course if I've misunderstood you and take your title in a more literal sense: what are you trying to accomplish by having a programmatic way to set the generated page title?

  2. gaearon commented on Dec 12, 2016

    @gaearon
    Contributor
  3. annorax commented on Dec 12, 2016

    @annorax
    Author

    Oops, I completely missed the fact that index.html is present in the public folder. What threw me off is the "Using the public Folder" section of the docs, which essentially describes the public folder strictly as a way to import assets without using Webpack, and discourages use of it where avoidable. Thanks for pointing this out!

  4. gaearon commented on Dec 12, 2016

    @gaearon
    Contributor

    Got it.
    I hope this is a bit better: ab3913c.

  5. locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions