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

A named, filterable grouping of pages. Defined as a YAML file in
`collections/`, resolved to matching pages at query time.

## Simple format

Collections can use flat `filters:` for common cases:

    name: Blog
    filters:
      prefix: /blog/
      tag: coffee

## Advanced format

For complex logic, use `filter_groups:` with AND/OR conditions:

    name: Coffee by Maya
    filter_groups:
      - logic: and
        conditions:
          - type: tag
            value: [coffee, tea]
          - type: author
            value: maya
    group_logic: or

The simple `filters:` format is normalized into a single AND group internally.

# `t`

```elixir
@type t() :: %Brix.Collection{
  description: String.t() | nil,
  extra: map() | nil,
  filter_groups: [Brix.Collection.FilterGroup.t()],
  filters: map() | nil,
  group_logic: :and | :or,
  meta_description: String.t() | nil,
  meta_title: String.t() | nil,
  name: String.t() | nil,
  og_description: String.t() | nil,
  og_image: String.t() | nil,
  og_title: String.t() | nil,
  parent: String.t() | nil,
  published_at: DateTime.t() | nil,
  slug: String.t() | nil,
  sort_by: String.t() | nil,
  sort_direction: :asc | :desc | nil
}
```

# `published?`

```elixir
@spec published?(t()) :: boolean()
```

Returns true if the collection is published (`published_at` is set and not in the future).
Collections with no `published_at` are considered published (visible by default).

---

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