--- import BaseLayout from "../layouts/BaseLayout.astro"; import { getCollection } from "astro:content"; import { formatBlogDate } from "../lib/blog"; import { getReadingTime } from "../lib/readingTime"; const featuredEssays = ( await getCollection("blog", ({ data }) => !data.draft && data.featuredEssay) ).sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()); const curatedEssays = featuredEssays.map((post) => ({ ...post, readingTime: getReadingTime(post.body), })); const recommendedPath = curatedEssays .filter((post) => typeof post.data.readingOrder === "number") .sort( (a, b) => (a.data.readingOrder ?? Number.MAX_SAFE_INTEGER) - (b.data.readingOrder ?? Number.MAX_SAFE_INTEGER), ); const categoryMap = new Map(); for (const post of curatedEssays) { if (!post.data.category) continue; const current = categoryMap.get(post.data.category) ?? []; current.push(post); categoryMap.set(post.data.category, current); } const categoryGroups = [...categoryMap.entries()].sort(([a], [b]) => a.localeCompare(b), ); function formatCategory(category: string) { return category.replace(/\b\w/g, (char) => char.toUpperCase()); } ---

Deeper writing

Library

==============================

This is the quieter shelf of the den: a place for longer posts, reflective essays, and writing worth revisiting. The blog keeps the full archive. The library is a smaller, curated reading room.

{ curatedEssays.length === 0 ? (

The shelf is still being arranged. For now, the deeper writing still lives in the blog until more posts are marked for the library.

) : ( <>

Highlighted Essays

Browse all posts

A small curated shelf of the more substantial writing on the site.

    {curatedEssays.map((post) => (
  • {post.readingTime.text}
    {post.data.category && ( {formatCategory( post.data.category, )} )}

    {post.data.title}

    {post.data.description}

    Read essay
  • ))}
{recommendedPath.length >= 2 && (

Recommended Reading Path

If you want a gentle path through the longer writing, start here.

    {recommendedPath.map((post) => (
  1. {post.data.readingOrder}

    {post.data.title}

    {post.data.description}

    {formatBlogDate( post.data.pubDate, )} {post.readingTime.text}
  2. ))}
)} {categoryGroups.length > 0 && (

Browse By Theme

The same shelf, grouped more loosely by what each piece leans toward.

{categoryGroups.map(([category, posts]) => (

{formatCategory(category)}

    {posts.map((post) => (
  • {post.data.title} {formatBlogDate( post.data .pubDate, )}{" "} ·{" "} { post.readingTime .text }
  • ))}
))}
)} ) }

Made with love by Latte