1.7 KiB
1.7 KiB
Pagination for Blog posts and Microblog feed
Your task is to add pagination to the blog posts index page and the statuses index page.
Requirements:
- Must use cursor based pagination NOT limit/offset
- Invalid pagination options should just redirect to the first page
- h-feed compatibility should be maintained
- microformat2 consumers should be able to discover all posts somehow
- if the h-feed spec allows for pagination just use the html pages
- consider reading the h-feed spec: https://microformats.org/wiki/h-feed to ensure compliance.
- microformat2 consumers should be able to discover all posts somehow
This involves several things
- Install the
flop
package- documentation: https://hexdocs.pm/flop/readme.html
- make sure to run
mix deps.get
after adding this dependency to themix.exs
file. - the current version is
0.26.1
, use this version
- Read through the Flop documentation to understand how the module works and all of the options available
- Derive
Flop.Schema
inSchema.Post
- Do not support any filtering or sorting for now
- Add new functions to the
Cost.Posts
module that support using Flop - Add pagination controls to the pages
- use the text "Newer posts" and "Older posts" justified with space between at the bottom of the page
- only show the pagination controls if there are newer or older posts respectively
- the newer posts and older posts links should always be in the same positions even if one is not rendered meaning if "newer posts" is not shown the "older posts" link should not suddenly show on the left-hand side
Think hard about this problem, review any rerference material, and then ask any clarifying questions or state assumptions for validation before continuing on to complete the task.