Astral.Collection (Astral v0.1.8)

Copy Markdown View Source

A configured content collection plus helpers for working with discovered entries.

Summary

Functions

Return entries for a collection from a discovered site.

Return a DateTime for an entry using normalized updated, date, then Unix epoch.

Return entries that are not marked as drafts in schema-normalized data.

Sort entries by schema-normalized updated or date.

Return unique string tags from schema-normalized entry data.

Types

t()

@type t() :: %Astral.Collection{
  dir: String.t(),
  drafts: boolean(),
  layout: String.t() | false | nil,
  name: atom(),
  permalink: String.t() | nil,
  schema: term()
}

Functions

entries(site, collection)

@spec entries(Astral.Site.t(), atom()) :: [Astral.Entry.t()]

Return entries for a collection from a discovered site.

entry_datetime(entry)

@spec entry_datetime(Astral.Entry.t()) :: DateTime.t()

Return a DateTime for an entry using normalized updated, date, then Unix epoch.

published(entries)

@spec published([Astral.Entry.t()]) :: [Astral.Entry.t()]

Return entries that are not marked as drafts in schema-normalized data.

sort_by_date(entries, direction \\ :desc)

@spec sort_by_date([Astral.Entry.t()], :asc | :desc) :: [Astral.Entry.t()]

Sort entries by schema-normalized updated or date.

tags(entries)

@spec tags([Astral.Entry.t()]) :: [String.t()]

Return unique string tags from schema-normalized entry data.