Skip to content

Add a Featured Writing section to the home page, hand-ordered from Notion #182

Description

@ooloth

Why

A first-time visitor's impression of the writing is set by whatever happened to be published last, not by the posts that best represent the site. The home page has no way to promote a post, so a strong older piece is buried under whatever is newest.

Current state

app/(home)/page.tsx renders <Summary /> followed by <RecentWriting /> and nothing else. ui/sections/home-recent-writing.tsx renders <PostList limit={5} />, and ui/sections/blog-post-list.tsx:30 fetches all posts sorted by First published descending, then slices the first 5. Of the 37 published blog posts, the home page therefore shows the 5 newest and offers no mechanism to surface anything else.

The Notion Writing data source now has a Featured order number property, populated on three posts:

Featured order First published Title
1 2024-07-29 Why unknown types are useful
2 2021-05-31 Using Slack to report data entry errors to content editors
3 2024-12-27 Converting a list of JS objects into a parent-child tree

Every other page reports number: null for the property. No code reads it yet.

Ideal state

  • A Featured Writing section renders above Recent Writing on the home page, using the same h2 treatment and the same date-above-title row markup, so the two sections differ only in their headings.
  • The section lists every published blog post whose Featured order is set, in ascending order of that number.
  • Featured order behaves as a sort key rather than a position: gaps between values, sets that do not start at 1, and values in any numeric range all render in ascending order with no warning and no error.
  • Two posts sharing the same Featured order render most-recently-published first relative to each other, so the rendered order is deterministic.
  • Recent Writing shows the 5 most recent published posts that are not already featured above, so no post appears twice on the page.
  • The Featured Writing section, heading included, is absent from the page when no post has a Featured order.
  • /blog lists every published post, featured ones included, exactly as it does today.
  • Changing which posts are featured, or the order they appear in, requires a Notion edit and a redeploy and no code change.

Out of scope

Starting points

  • ui/sections/home-recent-writing.tsx — the section whose markup and typography the new section matches
  • io/notion/schemas/post.tsPostPropertiesSchema and PostListItemSchema, where the new property is parsed at the boundary
  • app/(home)/page.tsx — where the single getPosts call and the split between featured and recent belong

QA plan

  1. Run npm run cache:clear:notion, then npm run dev, and open http://localhost:3000. Expect a Featured Writing heading above Recent Writing, indistinguishable from it in size, weight, colour, and spacing.
  2. Read the featured rows. Expect exactly three, in this order: Why unknown types are useful, Using Slack to report data entry errors to content editors, Converting a list of JS objects into a parent-child tree. Note that this is deliberately not date order.
  3. Read the recent rows. Expect Converting a list of JS objects into a parent-child tree to be absent, since it is featured above and was previously the second row. Expect 5 rows still, with It's tricky to statically type a "pipe" function in Python now the last of them.
  4. In Notion, set Why unknown types are useful to 3 and Converting a list of JS objects into a parent-child tree to 1. Run npm run cache:clear:notion and reload. Expect the featured order to follow the new numbers.
  5. In Notion, change the three values to 10, 20, and 30. Clear the cache and reload. Expect the same three posts in the same relative order, with no warning in the terminal and no error on the page.
  6. In Notion, give two featured posts the same number. Clear the cache and reload. Expect both to render, the more recently published one first, and the build to keep working.
  7. In Notion, clear Featured order on all three posts. Clear the cache and reload. Expect no Featured Writing heading anywhere on the page, and Recent Writing to show the 5 newest posts including Converting a list of JS objects into a parent-child tree.
  8. Restore the original values 1, 2, 3 and run npm run build. Expect a clean build, and out/index.html to contain both headings.
  9. Narrow the browser to 390px. Expect featured rows to stack date above title exactly as the recent rows do.

Done when

The home page renders a Featured Writing section ordered by the Notion Featured order property, and Recent Writing shows only posts not already featured above it.

Depends on

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions