Vox A performant static site generator built to scale.

⟵ Diary

Collections & Pagination

Goals

  • Supporting pages in multiple collections at once with path nesting.
  • If a build has failed, don’t immediately retry.
  • Upgrading all direct dependencies.
  • Rebuild if global.toml file or snippets subdirectory have changed.
  • Implement pagination.

Collections

To support this, collections must be renamed to depends, and collection to collections.

The rule: one collection per path component, and collections including each successive path component.

  • Collection names must be represented as Liquid identifiers so they can be used in templating in dependent pages.
  • Example: books/fantasy/page.vox is in books, fantasy, and books_fantasy.
  • Example: movies/fantasy/page.vox is in movies, fantasy, and movies_fantasy.

Retrying Builds

This was always the intended behaviour. The mistake was in accidentally checking for a JoinError when the build thread had completed, rather than checking for errors from the build thread.

Upgrading Dependencies

Notably, this brought my implementation of Jekyll’s sorting filter, which was merged into the Liquid Rust implementation.

Rebuild Global or Snippet Changes

Since neither global.toml or snippets are represented in the DAG (yet), the best that can be done is simply rebuilding everything if either change.

Pagination

Pages may have a pagination frontmatter value, containing:

  • pagination.collection: the name of a collection in a page’s depends list
  • pagination.page_size: the maximum number of collection pages per page

Pages using pagination are copied in memory, with each copy being supplied different pagination.page_number values. The pagination.page_number is used in a page’s permalink, and can be used with pagination.page_size:

  • to calculate the starting index in the collection for the current page
  • to calculate the total number of pages
  • to determine the URL of any page
  • to calculate the remaining number of pages
    • This requires the length of the paginated collection as well

This is not feasible to implement; pages are added to the DAG in an unpredictable order, so calculating pagination.page_number for each copy of a page is not possible, as the length of the collection being paginated is not yet known.


Future Goals

  • Parallelising as much as possible.
  • Removing code that was commented out.
  • Creating a logo for Vox.
  • Incorporating global.toml into DAG construction.
  • Incorporating snippets into DAG construction.
  • Move as much CLI code as possible into library.