pageFile

tcmts.cli.web.pageFile · #jjasx74o · term · runs anywhere

The file a static site keeps the page for a path of the app in: / is index.html, /today is today.html (static hosts serve it for /today), /docs/ is docs/index.html, and /apps.html is itself.

export function pageFile(appPath: string): string {
  const p = decodeURIComponent(appPath).slice(1);
  return !p || p.endsWith("/") ? `${p}index.html` : p.endsWith(".html") ? p : `${p}.html`;
}

used by