Type something to search...

Collections Configuration

Configure collections in .astrolock/astrolock.yaml

Configure collections in .astrolock/astrolock.yaml under the collections section.

Structure

collections:
  defaults:
    author: unknown
    contentType: text
    theme: astrobuild

  blog:
    displayName: Blog
    contentType: text
    features:
      archive: true

Section Options

OptionTypeDescription
defaultsobjectDefault values for all collections
Individual collection namesobjectCollection definitions (e.g., blog, gallery, mixes)

Default Options

OptionTypeDescription
authorstringDefault author
contentTypestringDefault content type
themestringDefault theme

Collection Options

OptionTypeRequiredDescription
displayNamestringYesHuman-readable name
contentTypestringYes”text”, “audio”, “images”, “video”
featuresobjectNoFeature toggles
defaultsobjectNoCollection-specific defaults

Features

FeatureValuesDefaultDescription
archivetrue / falsefalseDate-based browsing (year/month)
indexStyleposts / content / portfoliopostsHow to present the index page for the collection

Archive Feature

When archive: true, Astrolock generates date-based archive pages:

  • Year pages: /blog/archive/2025/ - All posts from 2025
  • Month pages: /blog/archive/2025/01/ - All posts from January 2025
  • Archive index: /blog/archive/ - Timeline view with all dates
collections:
  blog:
    features:
      archive: true

Tip

Archive pages are ideal for blogs and time-sensitive content where readers might want to browse by date.

Index Style Feature

Controls how the collection’s index page (/collection/) displays content:

StyleLayoutUse Case
postsCard grid with pagination and sidebarBlog-style collections
contentRenders -index.md body with optional TOCCurated landing pages
portfolioFull-width masonry galleryPhotography portfolios

Posts Style (Default)

Standard blog-style layout with cards, pagination, and sidebar widgets.

collections:
  blog:
    features:
      indexStyle: posts

Content Style

Renders the body content from content/{collection}/-index.md instead of auto-generated posts list. Useful for curated landing pages with custom content.

collections:
  flyers:
    features:
      indexStyle: content

Create your index content at content/{collection}/-index.md:

---
title: "My Collection"
---

Custom welcome text and curated content here...

Portfolio Style

Full-width masonry grid showing all images without pagination. Ideal for photography portfolios and visual showcases.

collections:
  gallery:
    features:
      indexStyle: portfolio

Info

Portfolio style is only available for contentType: "images" collections.

Complete Example

collections:
  defaults:
    author: Site Author
    contentType: text
    theme: astrobuild

  blog:
    displayName: Blog
    contentType: text
    features:
      archive: true

  flyers:
    displayName: Flyers
    contentType: images
    features:
      archive: false
      indexStyle: content

  mixes:
    displayName: DJ Mixes
    contentType: audio
    defaults:
      contentExtension: .mp3

  gallery:
    displayName: Photo Gallery
    contentType: images
    features:
      archive: false
      indexStyle: portfolio

Next Steps