Minimal site

import Astral.Config

site do
  pages "pages"

  layouts "layouts" do
    default "default.html"
  end
end

Common paths

site do
  root "."
  outdir "dist"
  pages "pages"
  public "public"
  components "components"
end

Layouts

layouts "layouts" do
  default "default.html"
end

Use a .astral layout:

layouts "layouts" do
  default "site.astral"
end

Assets

assets "assets" do
  entry "app.ts"
  url_prefix "/assets"
  hash true
end

Dynamic file routes

pages/blog/[slug].astral   -> /blog/:slug
pages/docs/[...path].md    -> /docs/*path

Read route params from templates and layouts with string keys:

<%= @params["slug"] %>

Content collections

collections do
  collection :posts, "content/posts" do
    permalink "/blog/:slug/"
    layout "post.html"

    schema do
      field :title, :string, required: true
      field :date, :date, required: true
      field :draft, :boolean, default: false
      field :tags, {:array, :string}, default: []
    end
  end
end

Plugins

plugins [
  {Astral.Plugin.Feed,
   site_url: "https://example.com",
   title: "My Blog",
   author: "Me",
   collection: :posts},
  {Astral.Plugin.Sitemap,
   site_url: "https://example.com"}
]