Still.Preprocessor.Pagination (Still v0.8.0) View Source

Paginates a Still.SourceFile if the key :pagination is present. The :pagination must be a hash containing the following keys:

  • :data - The data to paginate. This should be valid Elixir that returns a
          list. You can reference any variable in `:metadata` as you would in a
          template. For instance, you can return a global data file. See `Still.Data`
          for more information.
  • :size - The number of items per page.

Each Still.SourceFile will have a new :pagination key with the following format:

%{
  items: [1, 2],
  page_nr: 1,
  pages: [[1, 2], [3, 4], [5, 6]]
}

Where :items is the data of the current page; :page_nr is the number of the current page; and :pages is the data of all pages. You can reference :pagination in your templates.

Link to this section Summary

Functions

Runs after the next preprocessors finish running.

Runs the current preprocessor and invokes the next one.

Runs the Elixir.Still.SourceFile through the current preprocessor and the next.

Link to this section Functions

Link to this function

after_render(source_file)

View Source

Runs after the next preprocessors finish running.

Returns the resulting Elixir.Still.SourceFile.

Runs the current preprocessor and invokes the next one.

Returns the resulting Elixir.Still.SourceFile.

Runs the Elixir.Still.SourceFile through the current preprocessor and the next.

Link to this function

run(source_file, next_preprocessors)

View Source