コンテンツにスキップ
#0834
ExecFiles

Adding a page is adding a file

The client's help center is a folder of .md files. The site that renders it is one file: help/[[...path]].ts.

The optional catch-all matches /help, /help/billing, and /help/billing/refunds/partial alike; the segments arrive in metadata.parameters.path, an empty array for the index. The script joins them into a filename, fs.readFileSync reads the markdown, marked: bundled, nothing to install: turns it into HTML, and returning a string that starts with <!DOCTYPE sets text/html on its own. Wrap it in the client's template and return.

The client edits copy in the files service's web file manager, saves, and the page is different on the next request. No build, no deploy, no static-site generator, no CI job that sometimes fails. Adding a page is adding a file. The site is a folder of documents and one function that reads them.

The site is a folder of documents and one function that reads them.