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.
Summary
Callbacks
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 filesystem (or other backing store).
Callbacks
Looks up a redirect target for a legacy slug. Returns the new slug or :error.
@callback get_author(slug :: String.t()) :: {:ok, Brix.Author.t()} | :error
Fetches an author by slug.
@callback get_collection(slug :: String.t()) :: {:ok, Brix.Collection.t()} | :error
Fetches a collection by slug.
@callback get_layout(name :: String.t()) :: {:ok, Brix.Layout.t()} | :error
Fetches a layout by name.
@callback get_media(slug :: String.t()) :: {:ok, Brix.Media.t()} | :error
Fetches a media asset by slug.
@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
@callback get_section_template(name :: String.t()) :: {:ok, Brix.SectionTemplate.t()} | :error
Fetches a section template by name.
@callback get_site() :: Brix.Site.t()
Returns the site configuration.
@callback get_tag(slug :: String.t()) :: {:ok, Brix.Tag.t()} | :error
Fetches a tag by slug.
@callback list_authors() :: [Brix.Author.t()]
Lists all authors.
@callback list_child_collections(parent_slug :: String.t()) :: [Brix.Collection.t()]
Lists child collections whose parent matches the given slug.
@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)
@callback list_collections() :: [Brix.Collection.t()]
Lists all collections.
@callback list_media() :: [Brix.Media.t()]
Lists all media assets.
@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
@callback list_section_templates() :: [Brix.SectionTemplate.t()]
Lists all section templates.
@callback list_tags() :: [Brix.Tag.t()]
Lists all tags.
@callback reload() :: :ok | {:error, term()}
Reloads all content from the filesystem (or other backing store).