# `Brix`
[🔗](https://github.com/LoamStudios/brix/blob/main/lib/brix.ex#L1)

Structured content layer for Phoenix apps.

Brix models content as **pages** composed of **sections**, each rendered by a
named template. Pages live inside **layouts** that provide shared header/footer
sections, and can reference **authors**, **tags**, **media**, and **collections**.

All functions delegate to the configured store backend:

    config :brix, store: Brix.Store.Filesystem

# `find_redirect`

```elixir
@spec find_redirect(String.t()) :: {:ok, String.t()} | :error
```

Looks up a redirect target for a legacy slug. Returns the new slug or `:error`.

# `get_author`

```elixir
@spec get_author(String.t()) :: {:ok, Brix.Author.t()} | :error
```

Fetches an author by slug.

# `get_collection`

```elixir
@spec get_collection(String.t()) :: {:ok, Brix.Collection.t()} | :error
```

Fetches a collection by slug.

# `get_layout`

```elixir
@spec get_layout(String.t()) :: {:ok, Brix.Layout.t()} | :error
```

Fetches a layout by name.

# `get_media`

```elixir
@spec get_media(String.t()) :: {:ok, Brix.Media.t()} | :error
```

Fetches a media asset by slug.

# `get_page`

```elixir
@spec get_page(
  String.t(),
  keyword()
) :: {:ok, Brix.Page.t()} | :error
```

Fetches a page by slug.

## Options

  * `:status` — filter by publish status: `:published`, `:draft`, or `:all` (default `:published`)
  * `:prefix` — match pages whose slug starts with the given prefix

# `get_section_template`

```elixir
@spec get_section_template(String.t()) :: {:ok, Brix.SectionTemplate.t()} | :error
```

Fetches a section template by name.

# `get_shared_section`

```elixir
@spec get_shared_section(String.t()) :: {:ok, Brix.SharedSection.t()} | :error
```

Fetches a shared section by name.

# `get_site`

```elixir
@spec get_site() :: Brix.Site.t()
```

Returns the site configuration.

# `get_tag`

```elixir
@spec get_tag(String.t()) :: {:ok, Brix.Tag.t()} | :error
```

Fetches a tag by slug.

# `list_authors`

```elixir
@spec list_authors() :: [Brix.Author.t()]
```

Lists all authors.

# `list_child_collections`

```elixir
@spec list_child_collections(String.t()) :: [Brix.Collection.t()]
```

Lists child collections whose `parent` matches the given slug.

# `list_collection_pages`

```elixir
@spec list_collection_pages(
  Brix.Collection.t(),
  keyword()
) :: [Brix.Page.t()]
```

Lists pages belonging to a collection, applying its filters and sort order.

## Options

  * `:status` — filter by publish status: `:published`, `:draft`, or `:all` (default `:published`)

# `list_collections`

```elixir
@spec list_collections() :: [Brix.Collection.t()]
```

Lists all collections.

# `list_media`

```elixir
@spec list_media() :: [Brix.Media.t()]
```

Lists all media assets.

# `list_pages`

```elixir
@spec list_pages(keyword()) :: [Brix.Page.t()]
```

Lists pages.

## Options

  * `:status` — filter by publish status: `:published`, `:draft`, or `:all` (default `:published`)
  * `:prefix` — match pages whose slug starts with the given prefix

# `list_section_templates`

```elixir
@spec list_section_templates() :: [Brix.SectionTemplate.t()]
```

Lists all section templates.

# `list_shared_sections`

```elixir
@spec list_shared_sections() :: [Brix.SharedSection.t()]
```

Lists all shared sections.

# `list_tags`

```elixir
@spec list_tags() :: [Brix.Tag.t()]
```

Lists all tags.

# `reload`

```elixir
@spec reload() :: :ok | {:error, term()}
```

Reloads all content from the store backend.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
