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

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