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

Configuring title of generated index.html page #1255

Closed
annorax opened this issue Dec 12, 2016 · 4 comments
Closed

Configuring title of generated index.html page #1255

annorax opened this issue Dec 12, 2016 · 4 comments

Comments

@annorax
Copy link

annorax commented Dec 12, 2016

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.

@Timer
Copy link
Contributor

Timer commented Dec 12, 2016

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?

@gaearon
Copy link
Contributor

gaearon commented Dec 12, 2016

I added this to the docs:

https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#changing-the-page-title

I hope this helps!

@gaearon gaearon closed this as completed Dec 12, 2016
@annorax
Copy link
Author

annorax commented Dec 12, 2016

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!

@gaearon
Copy link
Contributor

gaearon commented Dec 12, 2016

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

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants