Astral.Collection (Astral v0.1.2)

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 updated, date, then Unix epoch.

Return entries that are not marked as drafts.

Sort entries by frontmatter updated or date.

Return unique string tags from entry data or metadata.

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 updated, date, then Unix epoch.

published(entries)

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

Return entries that are not marked as drafts.

sort_by_date(entries, direction \\ :desc)

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

Sort entries by frontmatter updated or date.

tags(entries)

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

Return unique string tags from entry data or metadata.