Static Content
Learn how to use static content and custom fonts in your document templates
All static files must be placed in the /documents/static
directory of your project. This is the required location for serving static assets in your document templates.
Client-Side Usage
Inside HTML/React components, static files are served directly from the /documents/static
directory. Access them using the absolute path:
Server-Side Usage
When reading files server-side (like in document templates), use process.env.DOCUMENTS_STATIC_PATH
to access files in your static directory:
Server-side files only work in local development and are not supported yet using the API.
If you’d like to see this feature, please leave a comment on the #feature-requests channel in Slack.
Example: Local Fonts
Place your font files anywhere in the /static
directory and load them using @font-face
:
Example: Loading Markdown Content
Here’s a complete example of loading and rendering markdown content in a document: