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

Behaviour for Brix content store backends.

Implement all callbacks to provide a content store. See `Brix.Store.Filesystem`
for the built-in flat-file implementation.

# `find_redirect`

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

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

# `get_author`

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

Fetches an author by slug.

# `get_collection`

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

Fetches a collection by slug.

# `get_layout`

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

Fetches a layout by name.

# `get_media`

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

Fetches a media asset by slug.

# `get_page`

```elixir
@callback get_page(slug :: String.t(), opts :: 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
@callback get_section_template(name :: String.t()) ::
  {:ok, Brix.SectionTemplate.t()} | :error
```

Fetches a section template by name.

# `get_shared_section`

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

Fetches a shared section by name.

# `get_site`

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

Returns the site configuration.

# `get_tag`

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

Fetches a tag by slug.

# `list_authors`

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

Lists all authors.

# `list_child_collections`

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

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

# `list_collection_pages`

```elixir
@callback list_collection_pages(collection :: Brix.Collection.t(), opts :: 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
@callback list_collections() :: [Brix.Collection.t()]
```

Lists all collections.

# `list_media`

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

Lists all media assets.

# `list_pages`

```elixir
@callback list_pages(opts :: 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
@callback list_section_templates() :: [Brix.SectionTemplate.t()]
```

Lists all section templates.

# `list_shared_sections`

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

Lists all shared sections.

# `list_tags`

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

Lists all tags.

# `reload`

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

Reloads all content from the filesystem (or other backing store).

---

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