Skip to content

Commit a663a3d

Browse files
committed
Mounted assets docs
1 parent 2708df3 commit a663a3d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ public/_redirects
66
public/analytics/static/downloads/main.css
77
src/content/workers-ai-models/*.json
88
tests/fixtures/openapi.json
9+
**/*.mdx

src/content/docs/workers/static-assets/routing.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,21 @@ Take the following directory structure:
218218
/not-found -> 200 /index.html
219219
/folder/doesnt/exist -> 200 /index.html
220220
```
221+
222+
## Mounting assets on a path
223+
224+
You can mount assets on a path by creating a directory structure that mirrors the desired path.
225+
For example, to serve assets from `example.com/blog`, create a `blog` directory in your asset directory.
226+
227+
<FileTree>
228+
- dist
229+
- blog
230+
- index.html
231+
- posts
232+
- post1.html
233+
- post2.html
234+
</FileTree>
235+
236+
In this example, requests to `example.com/blog` will serve the `index.html` file, and requests to `example.com/blog/posts/post1` will serve the `post1.html` file.
237+
238+
If you have a file outside the mounted path, it will not be served. For example, if you have a `home.html` file in the root of your asset directory, it will not be served when requesting `example.com/blog/home`.

0 commit comments

Comments
 (0)