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

Summary

Functions

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

Fetches an author by slug.

Fetches a collection by slug.

Fetches a layout by name.

Fetches a media asset by slug.

Fetches a page by slug.

Fetches a section template by name.

Fetches a shared section by name.

Returns the site configuration.

Fetches a tag by slug.

Lists all authors.

Lists child collections whose parent matches the given slug.

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

Lists all collections.

Lists all media assets.

Lists pages.

Lists all section templates.

Lists all shared sections.

Lists all tags.

Reloads all content from the store backend.

Functions

find_redirect(old_slug)

@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(slug)

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

Fetches an author by slug.

get_collection(slug)

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

Fetches a collection by slug.

get_layout(name)

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

Fetches a layout by name.

get_media(slug)

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

Fetches a media asset by slug.

get_page(slug, opts \\ [])

@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(name)

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

Fetches a section template by name.

get_shared_section(name)

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

Fetches a shared section by name.

get_site()

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

Returns the site configuration.

get_tag(slug)

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

Fetches a tag by slug.

list_authors()

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

Lists all authors.

list_child_collections(parent_slug)

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

Lists child collections whose parent matches the given slug.

list_collection_pages(collection, opts \\ [])

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

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

Lists all collections.

list_media()

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

Lists all media assets.

list_pages(opts \\ [])

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

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

Lists all section templates.

list_shared_sections()

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

Lists all shared sections.

list_tags()

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

Lists all tags.

reload()

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

Reloads all content from the store backend.