Create photo galleries and portfolios
Image collections display photographs and visual work in gallery layouts.
Creating an Image Entry
Using the CLI
astrolock content gallery "Mountain Landscape"
Manual Creation
Create a file at content/gallery/mountain-landscape.md:
---
title: "Mountain Landscape"
date: 2025-01-15T00:00:00Z
author: "Photographer Name"
description: "Stunning alpine views at sunset"
image: "/images/content/gallery/mountain.jpg"
categories:
- Landscapes
tags:
- Mountains
- Sunset
---
Notes about the photograph...
Warning
Put the image file at public/images/content/gallery/mountain.jpg
File Naming Convention
Like audio collections, images use automatic file inference:
| Markdown File | Expected Image File |
|---|---|
content/gallery/mountain.md | public/images/content/gallery/mountain.jpg |
content/flyers/event-poster.md | public/images/content/flyers/event-poster.jpg |
Tip
When the image frontmatter matches the filename pattern, you can omit it -
Astrolock will find the image automatically.
Frontmatter Reference
Minimal Example
---
title: "Mountain Landscape"
date: 2025-01-15T00:00:00Z
---
Full Example
---
title: "Golden Hour Mountains"
date: 2025-01-15T00:00:00Z
author: "Jane Smith"
description: "Stunning alpine views captured at sunset"
image: "/images/content/gallery/golden-hour-mountains.jpg"
altText: "Snow-capped mountains glowing orange in sunset light"
categories:
- Landscapes
- Nature
tags:
- Mountains
- Sunset
- Featured
orientation: "landscape"
imageDimensions:
width: 4000
height: 2667
exif:
camera: "Canon EOS R5"
lens: "24-70mm f/2.8"
iso: 400
aperture: "f/8"
shutterSpeed: "1/250"
focalLength: "35mm"
dateTaken: 2025-01-15
draft: false
---
Captured this stunning view during my trip to the Alps...
Required Fields
| Field | Description |
|---|---|
title | Image title |
Recommended Fields
| Field | Description |
|---|---|
date | Date taken/created |
image | Path to the image file |
description | Image description |
altText | Accessibility description |
categories | Groupings |
Image-Specific Fields
| Field | Description | Example |
|---|---|---|
orientation | Layout hint | "landscape", "portrait", "square" |
imageDimensions | Size info | { width: 1920, height: 1080 } |
exif | Camera data | See below |
EXIF Data
Store camera and shooting information:
exif:
camera: "Canon EOS R5"
lens: "24-70mm f/2.8"
iso: 400
aperture: "f/8"
shutterSpeed: "1/250"
focalLength: "35mm"
dateTaken: 2025-01-15
Info
EXIF data is optional but useful for photography portfolios.
Index Style
Control how your image collection index page displays using indexStyle:
| Style | Description |
|---|---|
posts | Card grid with pagination and sidebar (default) |
content | Renders -index.md body content with optional TOC |
portfolio | Full-width masonry gallery grid - ideal for photography |
Posts Style (Default)
Standard blog-style layout with cards and pagination:
{
"collections": {
"gallery": {
"displayName": "Photo Gallery",
"contentType": "images",
"features": {
"indexStyle": "posts"
}
}
}
}
Content Style
Use for curated pages where you want to write custom content:
{
"features": {
"indexStyle": "content"
}
}
Then write your index content in content/gallery/-index.md.
Portfolio Style
Best for photography portfolios - displays all images in a full-width masonry grid:
{
"collections": {
"portfolio": {
"displayName": "Portfolio",
"contentType": "images",
"features": {
"indexStyle": "portfolio"
}
}
}
}
Tip
Portfolio style shows all images without pagination, making it ideal for showcasing visual work.
Bulk Import
Import multiple photos at once from a folder:
astrolock import images gallery path/to/photos/
This creates markdown files for each image and copies the images to the correct location.
Info
See Image Import for detailed import options and EXIF extraction.
Next Steps
- Learn about Video Collections for video content
- Explore Audio Collections for music
- See Collection Configuration for all options
- Try Image Import for bulk uploads