Directory Inputs And Routes
pnpm fold preview DIR builds one release from a directory. Each file becomes one or more routes, depending on its type.
Files And Their Routes
| File | Published routes |
|---|---|
index.md |
/, /index.html, /index.md, /index.txt |
guide/index.md |
/guide/, /guide/index.html, /guide/index.md, /guide/index.txt |
about.html |
/about and /about.html |
data.json, notes.txt, notes.plain |
The authored path |
photo.jpg |
/photo.jpg and /_fold/media/HASH/photo.jpg, where HASH is the SHA-256 hex digest |
A Markdown page is published as HTML, as its Markdown source and as plain text. Authored HTML is sanitized and JSON is validated. If two files produce the same route, the build fails.
/_fold/index.json lists the path and title of every Markdown and HTML page in the release.
Limits
- The CLI skips
node_modulesand any entry whose name starts with a dot. - A path is relative, names a regular file and is at most 240 characters.
- A text file is at most 128,000 bytes, and a directory holds at most 900,000 bytes of text. Save text as UTF-8.
- A release holds at most 100 files.
- Binary files can be PNG, JPEG, WebP, AVIF, GIF, PDF, MP3, MP4 or WOFF2, up to 8 MiB each. The CLI uploads them separately, and files with identical bytes are sent once.
Front Matter
Front matter is the block between --- lines at the top of a Markdown page. FOLD strips it from every published form of the page. On a FOLD with site themes or content models on, it's parsed as YAML, so invalid front matter fails the build.
A page whose front matter sets fragment: true stays out of /_fold/index.json and is served with X-Robots-Tag: noindex. Use it for pages that other pages load, such as a navigation menu.
---
fragment: true
---
- [Home](./)
- [Guide](guide)
Redirects
A file named _redirects at the root holds same-site redirects. Each line is a source path, a destination path and an optional status of 301, 302, 307 or 308. The default is 302. Blank lines and lines that start with # are ignored.
/old-guide /guide 301
/start /
Every redirect must end at a page or file in the same release. The build rejects cycles, duplicate sources, missing targets and a source that is also a content path.
Not-Found Page
A root 404.md or 404.html is the release's not-found page. A request for a path the release doesn't have returns that page with status 404, on the live site and in a preview. Without it, a missing path returns a JSON error. Paths under /_fold/ always return the JSON error.
Next: Structured content