You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Configuring title of generated index.html page #1255
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.
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?
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!
Activity
Timer commentedon Dec 12, 2016
Editing
public/index.htmlis the proper way to configure your page's default title.The
public/directory should be checked into source control.build/is the directory which should be in your.gitignore.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 commentedon 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!
annorax commentedon Dec 12, 2016
Oops, I completely missed the fact that index.html is present in the
publicfolder. 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 commentedon Dec 12, 2016
Got it.
I hope this is a bit better: ab3913c.