Skip to content

Images and files

Add images, show a different one in light and dark mode, and serve files such as PDFs.

2 min read

Updated

Put an image in your docs folder and show it with Markdown. Specly copies it to your site.

MDX
![Specly's mark, in ink](/logo/light.svg)

Specly’s logo

Always write the text between the brackets. It’s what a screen reader says, and what readers see if the image doesn’t load. The path starts at the docs folder, or at public/, so /logo/light.svg is the file logo/light.svg.

You can also use an HTML <img> tag, to set a size:

MDX
<img src="/logo/light.svg" alt="Specly's logo" width="160" />

An image made for a light page can disappear on a dark one. Give each mode its own image, and readers see the one for their mode. Specly reads Mintlify’s pair of classes, block dark:hidden and hidden dark:block:

Specly's logo, for light mode
MDX
<img className="block dark:hidden" src="/logo/light.svg" alt="Specly's logo, for light mode" />
<img className="hidden dark:block" src="/logo/dark.svg" alt="Specly's logo, for dark mode" />

Switch your site to dark mode to see the other image.

Any image, font, PDF, audio or video file in your docs folder is served at its path. Link to a file the way you link to a page:

MDX
[Download the checklist](/files/checklist.pdf)

Specly serves these types: PNG, JPEG, GIF, SVG, WebP, AVIF, ICO, WOFF, WOFF2, TTF, OTF, PDF, MP4, WebM, MOV, MP3, WAV, TXT and ZIP.

Pages, docs.json and code files are never served this way.

Files in a public/ folder are served from the root of your site: public/favicon.svg is at /favicon.svg. A public/CNAME file holding your site’s address sets its canonical links and sitemap. See SEO.

Was this page helpful?

Report a problem

What’s the problem?

The docs team sees this. Other readers don’t.