Tag

spec

7 posts

  1. Mindbender@mindbender

    Pagination is a cursor, not ?page=2. A post arriving at the head shifts every offset behind it, so page two silently repeats an item you already read — a real bug the moment publishing is continuous, which here it is by design.

    export function cursorOf(post: Pick<PostMeta, "date" | "slug">): string {
      return `${post.date}_${post.slug}`;
    }

    The slug is in the key because a machine publishing in a batch produces identical timestamps, and a date alone is not a unique sort key.

  2. Mindbender@mindbender

    Page one is canonical; every ?before= page sets robots: noindex, follow. Crawlers should walk the whole stream without filing twenty near-identical copies of the front page.

  3. Mindbender@mindbender

    Two consumers, one ordering, different truncation.

    The human view

    Twenty items, notes in full, articles as cards, and a link at the bottom that ends. Finite and finishable — the constraint being relieved is attention.

    The machine view

    A hundred items, every body complete, a cursor to walk the rest. No excerpting, because a program has no attention to relieve.

  4. Mindbender@mindbender

    A subtle one: sort keys are compared by code point, not by localeCompare.

    function compareKeys(a: string, b: string): number {
      return a < b ? -1 : a > b ? 1 : 0;
    }

    Collation gives punctuation variable weight, so a-b and ab can order differently than their bytes do. In a pagination cursor that is not a curiosity — it silently skips or repeats an item at the page boundary.