From b50c649af4dc187868e3fbe7cb8abb02b1b37cbc Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 22 Nov 2026 12:57:01 +0000 Subject: [PATCH] Hide public notes from the garden index The garden lists posts only. Public Notes stay on /notes/, and growth is still calculated with those notes present. Co-authored-by: Shumin --- src/pages/posts/index.astro | 36 ++++++++++++++++--------------- src/pages/posts/page/[page].astro | 11 +++++----- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/pages/posts/index.astro b/src/pages/posts/index.astro index d650faf..cb519e0 100644 --- a/src/pages/posts/index.astro +++ b/src/pages/posts/index.astro @@ -2,7 +2,7 @@ /** * Posts Listing Page * - * Lists all garden posts/notes + * Lists garden posts. Public Notes stay on /notes/. * Supports grid/list layout toggle and pages/infinite pagination via config */ @@ -17,7 +17,7 @@ import Pagination from '../../components/Pagination.astro'; import InfiniteScroll from '../../components/InfiniteScroll.astro'; import { getCollection } from 'astro:content'; import { siteConfig } from '../../config'; -import { calculateAllGrowth, getEffectiveGrowth, participatesInGrowth } from '../../utils/growth'; +import { calculateAllGrowth, getEffectiveGrowth, isNote, participatesInGrowth } from '../../utils/growth'; // Get all posts, filter drafts in production const allPosts = await getCollection('posts', ({ data }) => { @@ -43,11 +43,13 @@ for (const [postId, result] of growthResults) { const getPostGrowth = (post: typeof allPostsSorted[0]) => effectiveGrowthMap.get(post.id) || post.data.growth; -// Notes stay under All only; stage tabs count posts that can grow. -const seedlings = allPostsSorted.filter(p => participatesInGrowth(p.data.tags) && getPostGrowth(p) === 'seedling'); -const budding = allPostsSorted.filter(p => participatesInGrowth(p.data.tags) && getPostGrowth(p) === 'budding'); -const evergreen = allPostsSorted.filter(p => participatesInGrowth(p.data.tags) && getPostGrowth(p) === 'evergreen'); -const cardGrowth = (post: typeof allPostsSorted[0]) => +// Growth uses the full set, so a public note can still move a post between stages. +// The garden itself lists only posts. +const gardenPosts = allPostsSorted.filter((post) => !isNote(post.data.tags)); +const seedlings = gardenPosts.filter(p => participatesInGrowth(p.data.tags) && getPostGrowth(p) === 'seedling'); +const budding = gardenPosts.filter(p => participatesInGrowth(p.data.tags) && getPostGrowth(p) === 'budding'); +const evergreen = gardenPosts.filter(p => participatesInGrowth(p.data.tags) && getPostGrowth(p) === 'evergreen'); +const cardGrowth = (post: typeof gardenPosts[0]) => participatesInGrowth(post.data.tags) ? getPostGrowth(post) : undefined; // Config @@ -55,14 +57,14 @@ const { postsPerPage, layout, pagination } = siteConfig.posts; const isInfinite = pagination === 'infinite'; // For infinite scroll, show all posts; for pages, show first page only -const posts = isInfinite ? allPostsSorted : allPostsSorted.slice(0, postsPerPage); -const totalPages = Math.ceil(allPostsSorted.length / postsPerPage); +const posts = isInfinite ? gardenPosts : gardenPosts.slice(0, postsPerPage); +const totalPages = Math.ceil(gardenPosts.length / postsPerPage); -// Get unique tags from all posts -const allTags = [...new Set(allPostsSorted.flatMap((post) => post.data.tags || []))].sort(); +// Tags that remain on the posts listed here. +const allTags = [...new Set(gardenPosts.flatMap((post) => post.data.tags || []))].sort(); --- - +
@@ -73,7 +75,7 @@ const allTags = [...new Set(allPostsSorted.flatMap((post) => post.data.tags || [ The Garden

- {allPostsSorted.length} notes growing in this garden + {gardenPosts.length} notes growing in this garden

@@ -89,7 +91,7 @@ const allTags = [...new Set(allPostsSorted.flatMap((post) => post.data.tags || [ class="growth-tab inline-flex items-center gap-2 rounded-xl px-4 py-2 font-sans font-medium transition-colors bg-primary-900 text-primary-50 dark:bg-primary-100 dark:text-primary-950" > All - {allPostsSorted.length} + {gardenPosts.length}