Type something to search...

Viewing Your Site

Preview your site locally while developing

Astrolock provides two ways to view your site locally: Write mode for active development, and Preview mode to test the final build.

Write Mode (Development)

Use this when actively creating or editing content:

astrolock write

Then open http://localhost:4321 in your browser.

Key features:

  • Live reload - Changes appear instantly when you save a file
  • Fast startup - Starts in seconds
  • Error messages - Helpful debugging info in the terminal

Tip

Keep this running in a terminal window while you work. Open a second terminal for other commands.

Stopping Write Mode

Press Ctrl + C in the terminal to stop the server.

Preview Mode (Production Test)

Use this to test how your site will look when published:

astrolock preview

This builds your entire site first, then serves it locally.

When to use Preview mode:

  • Before publishing to catch any build errors
  • To test features that only work in production (like search)
  • To verify images and links work correctly

Warning

Preview mode doesn’t update automatically. Run it again after making changes.

Comparing the Two Modes

FeatureWrite ModePreview Mode
Commandastrolock writeastrolock preview
SpeedInstant updatesRequires rebuild
PurposeActive developmentFinal testing
Use whenWriting contentBefore publishing

Common Issues

  1. Check Docker is running - Look for the Docker whale icon
  2. Check the port - Make sure nothing else is using port 4321
  3. Restart - Press Ctrl + C and run the command again

In Write mode:

  • Save the file (Cmd/Ctrl + S)
  • Check for errors in the terminal

In Preview mode:

  • You need to stop and restart to see changes

The terminal shows helpful error messages. Common ones:

  • “Frontmatter error” - Check your YAML formatting at the top of the file
  • “File not found” - An image or link path is wrong
  • “Port in use” - Another process is using port 4321

Next Steps