Type something to search...

Image Collections

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 FileExpected Image File
content/gallery/mountain.mdpublic/images/content/gallery/mountain.jpg
content/flyers/event-poster.mdpublic/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

FieldDescription
titleImage title
FieldDescription
dateDate taken/created
imagePath to the image file
descriptionImage description
altTextAccessibility description
categoriesGroupings

Image-Specific Fields

FieldDescriptionExample
orientationLayout hint"landscape", "portrait", "square"
imageDimensionsSize info{ width: 1920, height: 1080 }
exifCamera dataSee 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:

StyleDescription
postsCard grid with pagination and sidebar (default)
contentRenders -index.md body content with optional TOC
portfolioFull-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