Type something to search...

Managing Collections

Create, configure, and organize your content collections

Collections are configured in your .astrolock/astrolock.yaml file.

Creating a Collection

Edit .astrolock/astrolock.yaml and add your collection under the collections section:

collections:
  # Your collections
  blog:
    displayName: "Blog"
    contentType: "text"
    defaults:
      author: ""
      ctaText: "Read more"
    features:
      archive: true

  # Add your new collection here
  podcast:
    displayName: "Podcast"
    contentType: "audio"
    defaults:
      author: "Your Name"
      contentExtension: "mp3"
      ctaText: "Read more"
    features:
      archive: false

Tip

Collection names should be lowercase with hyphens (e.g., photo-gallery, podcast-episodes). These names become part of your URLs: /photo-gallery/my-post

After Adding a Collection

Once you’ve added a collection to .astrolock/astrolock.yaml:

  1. Create the content directory:

    mkdir -p content/[collection-name]
  2. Restart the dev server to pick up the new collection:

    # Stop the current server (Ctrl+C)
    astrolock write
  3. Add content using the CLI:

    astrolock content [collection-name] "My First Post"

Collection Configuration

Collections are defined in the collections section of .astrolock/astrolock.yaml:

collections:
  defaults:
    author: "unknown"
    contentType: "text"
    theme: "default"

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

Collection Options

OptionDescriptionExample
displayNameShown in navigation"DJ Mixes"
contentTypeContent type"text", "audio", "images", "video"
featuresEnable collection featuresSee below
defaultsDefault values for content{ "contentExtension": ".mp3" }

Features

Enable optional features per collection:

blog:
  displayName: "Blog"
  contentType: "text"
  features:
    archive: true
    indexStyle: "content"
FeatureValuesDefaultDescription
archivetrue / falsefalseDate-based browsing (year/month)
indexStyleposts / content / portfoliopostsHow to present the index page for the collection

Info

Content Folders

Each collection has a content folder:

content/
├── blog/           # Blog posts
├── mixes/          # Audio files
├── gallery/        # Images
└── videos/         # Video content

Media files go in the public folder:

public/
├── audio/content/mixes/      # Audio files
├── images/content/gallery/   # Image files
└── video/content/videos/     # Video files

Adding to Navigation

Collections appear in navigation automatically. To customize the menu, edit .astrolock/astrolock.yaml:

{
  "main": [
    { "name": "Blog", "url": "/blog/" },
    { "name": "Mixes", "url": "/mixes/" }
  ]
}

Info

See Menu Configuration for full options.

Removing a Collection

  1. Remove from .astrolock/astrolock.yaml collections section
  2. Delete the content folder (content/{collection}/)
  3. Delete media files (public/{type}/content/{collection}/)
  4. Update navigation in .astrolock/astrolock.yaml if needed

Next Steps