Brix.Collection (Brix v0.1.1)

Copy Markdown View Source

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.

Summary

Functions

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).

Types

t()

@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
}

Functions

published?(collection)

@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).