Public directory
public is a directory that contains files that are made available publicly without any processing.
Example:
- A PDF located in public/static/book.pdf
- would be publicly available at https://yourdomain.tld/static/book.pdf
Files Type Example
It's use for files:
- referenced in HTML metadata (<link rel="icon" href="/favicon.ico">)
- whose paths must stay stable (e.g., referenced from a CMS, email template, or external service)
- you don't want to be transformed
- files that you want to share/distribute
Example:
- Shareable Files:
- PDF,
- Word document
- HTML Metadata Files
- robots.txt,
- sitemap.xml,
- manifest.json and favicon.ico
How to reference a public resource in pages?
A PDF located in public/static/book.pdf would be referenced in a page as :
- HTML syntax for Programmatic Pages (Jsx, Tsx)
- Markdown syntax for Markdown pages.
Configuration
You can set the path of the public directory in the paths configuration.