Unverified Commit b9620e6b authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

docs: improve file tree (#77889)

The file tree can be improved and share the same convention:

- Use the `txt` file extension.
- One tab indented.
- Use file tree with root `.` and trailing slash for folders.

x-ref: https://tree.nathanfriend.io
parent 4f5531b1
...@@ -156,13 +156,13 @@ Navigating to the `/mdx-page` route should display your rendered MDX page. ...@@ -156,13 +156,13 @@ Navigating to the `/mdx-page` route should display your rendered MDX page.
Create a new page within the `/app` directory and an MDX file wherever you'd like: Create a new page within the `/app` directory and an MDX file wherever you'd like:
```txt ```txt
my-project .
├── app ├── app/
│ └── mdx-page │ └── mdx-page/
│ └── page.(tsx/js) │ └── page.(tsx/js)
├── markdown ├── markdown/
│ └── welcome.(mdx/md) │ └── welcome.(mdx/md)
|── mdx-components.(tsx/js) ├── mdx-components.(tsx/js)
└── package.json └── package.json
``` ```
...@@ -173,12 +173,12 @@ Create a new page within the `/app` directory and an MDX file wherever you'd lik ...@@ -173,12 +173,12 @@ Create a new page within the `/app` directory and an MDX file wherever you'd lik
Create a new page within the `/pages` directory and an MDX file wherever you'd like: Create a new page within the `/pages` directory and an MDX file wherever you'd like:
```txt ```txt
my-project .
├── pages ├── markdown/
│ └── mdx-page.(tsx/js)
├── markdown
│ └── welcome.(mdx/md) │ └── welcome.(mdx/md)
|── mdx-components.(tsx/js) ├── pages/
│ └── mdx-page.(tsx/js)
├── mdx-components.(tsx/js)
└── package.json └── package.json
``` ```
......
...@@ -21,14 +21,15 @@ In the Pages Router, only special files are allowed to generate pages. You canno ...@@ -21,14 +21,15 @@ In the Pages Router, only special files are allowed to generate pages. You canno
Correct structure: Correct structure:
``` ```txt
pages/ .
├── index.js ├── components/
└── about.js │ └── Header.js
components/ ├── pages/
└── Header.js │ ├── about.js
styles/ │ └── index.js
└── globals.css └── styles/
└── globals.css
``` ```
#### App Router (Next.js 13+) #### App Router (Next.js 13+)
...@@ -37,15 +38,16 @@ The App Router allows [colocation](/docs/app/getting-started/project-structure#c ...@@ -37,15 +38,16 @@ The App Router allows [colocation](/docs/app/getting-started/project-structure#c
Example folder structure: Example folder structure:
``` ```txt
app/ .
├── layout.tsx └── app/
├── page.tsx ├── about/
├── about/ │ └── page.tsx
│ └── page.tsx ├── blog/
└── blog/ │ ├── page.tsx
├── page.tsx │ └── PostCard.tsx
└── PostCard.tsx ├── layout.tsx
└── page.tsx
``` ```
### 2. Handle undefined props and missing data ### 2. Handle undefined props and missing data
......
...@@ -14,25 +14,23 @@ You can move your `static` directory inside of the `public` directory and all UR ...@@ -14,25 +14,23 @@ You can move your `static` directory inside of the `public` directory and all UR
**Before** **Before**
``` ```txt
static/ .
my-image.jpg ├── pages/
pages/ │ └── index.js
index.js └── static/
components/ └── my-image.jpg
my-image.js
``` ```
**After** **After**
``` ```txt
public/ .
static/ ├── pages/
my-image.jpg │ └── index.js
pages/ └── public/
index.js └── static/
components/ └── my-image.jpg
my-image.js
``` ```
## Useful Links ## Useful Links
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment