Guides
Static Files
This documentation is for the preview version of the Dev Portal. If you are not part of the preview program, please refer to the current Dev Portal docs.
Dev Portal makes it easy to serve static files like images, PDFs, or any other assets alongside your documentation. Any files placed in the public
directory will be served at the root path of your documentation site.
Usage
- Create a
public
directory in your project root if it doesn't exist already - Place any static files in this directory
- Reference these files in your documentation using the root path
/
Example
If you have the following structure:
your-project/ ├── public/ │ ├── images/ │ │ └── diagram.png │ └── documents/ │ └── api-spec.pdf └── ...plain
You can reference these files using markdown like this:
md
If you want users to download a file like a PDF, you can use an anchor tag like this:
<a href="/documents/api-spec.pdf" download="/documents/api-spec.pdf">Download API specification</a>html
Relative paths
If you want to reference a file that is in the same directory as the current file, you can also use a relative path:
page.mdx
md