Deneb ReactJs documentation
Images
Where to put pictures, which fields use them, and how to prepare them so the site stays fast.
The download has no photos. Every picture slot shows a soft placeholder until you add a picture.
Add a picture
- Put the file in
public/assets/img/. - In the content file, set the field to its address, starting with
/assets/img/:
image: /assets/img/team.webp
image_alt: "The team in a bright meeting room"
Always write image_alt too. It describes the picture for screen readers and search engines.
Where pictures are used
| File | Fields |
|---|---|
content/pages/*.md, about section |
image, image_alt, image_label |
content/data/team.yml |
image, image_alt for each person |
content/portfolio/*.md |
image, image_small, image_alt |
content/posts/*.md |
image, image_small, image_alt |
content/authors/*.md |
avatar (a round picture, or initials if empty) |
image_label is the word shown on the placeholder, and it is only used while there is no picture.
Prepare your pictures
- Use WebP. It is much smaller than JPEG or PNG at the same quality.
- Make each picture at least twice the width it shows at, so it stays sharp on high-density screens. Pictures show in a 1200 pixel frame at most, so about 2400 pixels wide is the most you need.
- Keep each file as small as you can without visible loss. A few hundred KB is a good target for a cover.
- For projects and posts, add a smaller
image_smallversion for the cards. The cards use it, and the project or post page uses the large one.
Sizes and shapes
The theme crops each picture to a fixed shape, so the layout does not jump while images load. A picture is shown as:
| Where | Shape |
|---|---|
| Project and post covers | 21 by 9 |
| Cards for posts | 16 by 9 |
The about section |
4 by 3 |
| Team photos | Square |
Keep the subject near the middle so cropping does not cut it off.
Next.js image optimisation is off
next.config.mjs sets images: { unoptimized: true }, because a static export has no image server. The site uses a plain <img> tag in components/Img.js, and it does not resize pictures for you. Resize and compress them yourself before you add them.