Astral.Pagination (Astral v0.1.8)

Copy Markdown View Source

Static pagination helpers for generated Astral routes.

pages/2 splits an in-memory collection into page structs and generates canonical URLs from an Astral.Route.Pattern compatible pattern:

Astral.Pagination.pages(entries,
  pattern: "/blog/*page",
  page_size: 10
)

The *page glob form omits the page parameter for the first page, producing /blog/, /blog/2/, /blog/3/, and so on. A required :page parameter can be used when page one should be explicit: /blog/1/, /blog/2/.

Summary

Functions

Build static pagination pages for entries.

Convert pagination pages into generated routes.

Functions

pages(entries, opts)

@spec pages(
  list(),
  keyword()
) :: [Astral.Pagination.Page.t()]

Build static pagination pages for entries.

routes(pages, config, opts \\ [])

Convert pagination pages into generated routes.