Skip to content

Commit 2d29372

Browse files
gaearonalexdriaguine
authored andcommitted
Add "Changing the Page Title" to User Guide (facebook#1256)
* Add "Changing the Page Title" to User Guide * Add link to main README
1 parent 637decf commit 2d29372

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ The [User Guide](https://github.com/facebookincubator/create-react-app/blob/mast
104104
- [Available Scripts](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#available-scripts)
105105
- [Syntax Highlighting in the Editor](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#syntax-highlighting-in-the-editor)
106106
- [Displaying Lint Output in the Editor](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#displaying-lint-output-in-the-editor)
107+
- [Changing the Page `<title>`](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#changing-the-page-title)
107108
- [Installing a Dependency](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#installing-a-dependency)
108109
- [Importing a Component](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#importing-a-component)
109110
- [Adding a Stylesheet](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-a-stylesheet)

packages/react-scripts/template/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
1515
- [npm run eject](#npm-run-eject)
1616
- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor)
1717
- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor)
18+
- [Changing the Page `<title>`](#changing-the-page-title)
1819
- [Installing a Dependency](#installing-a-dependency)
1920
- [Importing a Component](#importing-a-component)
2021
- [Adding a Stylesheet](#adding-a-stylesheet)
@@ -197,6 +198,16 @@ npm install -g eslint-config-react-app@0.3.0 eslint@3.8.1 babel-eslint@7.0.0 esl
197198

198199
We recognize that this is suboptimal, but it is currently required due to the way we hide the ESLint dependency. The ESLint team is already [working on a solution to this](https://github.com/eslint/eslint/issues/3458) so this may become unnecessary in a couple of months.
199200

201+
## Changing the Page `<title>`
202+
203+
You can find the source HTML file in the `public` folder of the generated project. You may edit the `<title>` tag in it to change the title from “React App” to anything else.
204+
205+
Note that normally you wouldn't edit files in the `public` folder very often. For example, [adding a stylesheet](#adding-a-stylesheet) is is done without touching the HTML.
206+
207+
If you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API. For more complex scenarios when you want to change the title from React components, you can use [React Helmet](https://github.com/nfl/react-helmet), a third party library.
208+
209+
Finally, if you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](#generating-dynamic-meta-tags-on-the-server).
210+
200211
## Installing a Dependency
201212

202213
The generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with `npm`:

0 commit comments

Comments
 (0)