Serving Static Content in Pages
Any file in pb_pages that isn't a page (.ets, .md or .tsx, or the JavaScript versions .ejs and .jsx), a framework file (+...), private (_...) or ignored (names starting with - or .) is a static file. It's served as-is at its path, with groups removed:
pb_pages/
assets/
app.css -> /assets/app.css
logo.png -> /assets/logo.png
documents/
terms.pdf -> /documents/terms.pdf
(marketing)/
brochure.pdf -> /brochure.pdf
favicon.ico -> /favicon.ico
index.ets -> / (a page, not static)
- The content type comes from the extension.
- The
ETagcomes from the content hash; a matchingIf-None-Matchgets304. - A static file and a page can't claim the same URL (startup error).
For cache-friendly URLs, reference files through asset().
pb_pages and pb_public
A URL nothing in pb_pages matches goes on to pb_public, so you can keep using pb_public for files you don't want next to your pages.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.