Type something to search...

Step 2: Advanced Features

Collections, formatting, stock images, and customization options

Tip

Prerequisites: Complete Step 1: Getting Started first. You should have a working local site before continuing.

What You’ll Learn

By the end of this guide, you’ll know how to:

  • ✅ Create media collections (audio, images, video)
  • ✅ Customize collection display with indexStyle
  • ✅ Use stock images for development
  • ✅ Customize CTAText and collection defaults
  • ✅ Understand all available options

Time Required: 20-30 minutes


Creating Collections

Collections organize related content - blog posts, photo galleries, audio mixes, or videos.

Add a Collection Interactively

Run the collection wizard:

astrolock collection add

The wizard will ask:

Collection name (URL-friendly, e.g., 'gallery', 'mixes'): photos
Display name (shown in navigation): Photo Gallery

Choose content type:
  1) Text (blog posts, articles)
  2) Audio (music, podcasts, mixes)
  3) Images (photos, galleries)
  4) Video (tutorials, vlogs)

Choose (1-4): 3
File extension [jpeg]: jpg

✓ Collection 'photos' added to .astrolock/astrolock.yaml

The wizard creates the collection configuration and directory structure for you.

Collection Types

Use for: Blog posts, articles, documentation, pages

collections:
  blog:
    displayName: "Blog"
    contentType: "text"
    defaults:
      author: "Your Name"
      ctaText: "Read more"

Creating content:

astrolock content blog "My Post Title"

Creates content/blog/my-post-title.md with markdown content.


Customizing Collection Display

Index Style

Control how your collection’s index page looks with indexStyle:

Standard blog layout with cards, pagination, and sidebar

collections:
  blog:
    features:
      indexStyle: "posts"

Best for: Blogs, news, time-based content

Shows paginated grid of posts with excerpts and metadata.