The short answer
ESA Functions & Pages uses trailing-slash routing:
/about301-redirects to/about/whenabout.htmlorabout/index.htmlexists;- link directly to
/about/to avoid the extra hop; - directory entries use
index.html; - static sites use
404Page; single-page apps usesinglePageApplication.
Recommended structure
/
├─ index.html → /
├─ about/index.html → /about/
├─ products/index.html → /products/
├─ 404.html
└─ assets/esa.jsonc
{
"name": "my-site",
"assets": {
"directory": "./public",
"notFoundStrategy": "404Page"
}
}assets.directorypoints at the built static output and must containindex.html;404Pagereturns404.htmlwith status 404 for unmatched paths;singlePageApplicationreturns/index.htmlwith status 200 (SPA only).
Common mistakes
- Linking
/aboutinstead of/about/: an avoidable 301 on every click. - Using
singlePageApplicationfor a multi-page site: every unknown URL renders the home page. - Pointing
assets.directoryat source files instead of the build output. - Mixed-case file names.
Checklist
- [ ]
index.htmlin the static directory - [ ] Every internal link ends with
/ - [ ] Multi-page site uses
404Pageand ships404.html - [ ] Only SPAs use
singlePageApplication - [ ]
assets.directorypoints at the build output - [ ] canonical and sitemap use trailing-slash URLs
Copyable prompt
You are a front-end engineer. Build a static multi-page website for [brand / business] for Alibaba Cloud ESA Functions & Pages.
Rules:
1. Output index.html; each page lives in a directory with index.html (about/index.html, products/index.html, blog/post/index.html); assets under assets/.
2. Every internal link is a root-relative path with a trailing slash: /, /about/, /products/, /blog/post/. Never link to about.html, never use /about without the slash, never use ../.
3. canonical, og:url, sitemap and JSON-LD use the same trailing-slash URLs.
4. Also output esa.jsonc with assets.directory pointing at the static output and notFoundStrategy: "404Page". Only a SPA should use singlePageApplication.
5. Lowercase file names, digits and hyphens only.
6. No server-side routing, Node or database; HTML, CSS and vanilla JavaScript only.
7. Include 404.html.
8. Output the full file list and every file's full content; no ellipses.
9. Write the copy in [language].About the author
Bweb Editorial TeamContent and editorial
Turning first-hand building, publishing, domain and acquisition work into steps readers can follow.
Reviewed by: SHUOFENG
Facts are checked by a person before publishing; AI only assists with drafts and translation.
Editorial standards