diff --git a/services/site/src/components/blog/ConnectedPages.astro b/services/site/src/components/blog/ConnectedPages.astro index 5da8808..45dcde5 100644 --- a/services/site/src/components/blog/ConnectedPages.astro +++ b/services/site/src/components/blog/ConnectedPages.astro @@ -6,8 +6,12 @@ import SidePanel from "./SidePanel.astro"; interface Props { items: Connected[]; + /** A roundup links many pages; past this many the panel counts the rest. */ + max?: number; } -const { items } = Astro.props; +const { items: all, max = 8 } = Astro.props; +const items = all.length > max + 1 ? all.slice(0, max) : all; +const more = all.length - items.length; --- { items.length > 0 && ( @@ -26,11 +30,17 @@ const { items } = Astro.props; ))} + {more > 0 &&

And {more} more, each linked in the post.

} ) } diff --git a/services/site/src/components/blog/PostLayout.astro b/services/site/src/components/blog/PostLayout.astro index f0b15b1..dd52b08 100644 --- a/services/site/src/components/blog/PostLayout.astro +++ b/services/site/src/components/blog/PostLayout.astro @@ -16,6 +16,7 @@ import { connectedPages, neighbours, nowStatuses, pageLinks, readMinutes, relate import { formatDate, mediaSrc, type SiteIndex } from "../../lib/site.ts"; import ConnectedPages from "./ConnectedPages.astro"; import CrumbHero from "./CrumbHero.astro"; +import PageChips from "./PageChips.astro"; import PostList from "./PostList.astro"; import SidePanel from "./SidePanel.astro"; import StarHeading from "./StarHeading.astro"; @@ -67,7 +68,7 @@ const making = d.topic === "Making"; {readMinutes(body)} min read {(links.length > 0 || now.length > 0) && } {now.map((st) => Now · {st.data.kind})} - {links.map((l) => {l.label})} + diff --git a/services/site/src/components/blog/PostRow.astro b/services/site/src/components/blog/PostRow.astro index 1946e93..0254c6d 100644 --- a/services/site/src/components/blog/PostRow.astro +++ b/services/site/src/components/blog/PostRow.astro @@ -3,11 +3,11 @@ * One post as a fixed-height row: picture, topic and date, title, a * two-line summary, Now chips for linked notes and page-link chips. */ -import Chip from "@gk/ui/components/Chip.astro"; import Star from "@gk/ui/components/Star.astro"; import StatusPill from "@gk/ui/components/StatusPill.astro"; import { dateLine, nowStatuses, pageLinks, type Post } from "../../lib/blog.ts"; import { mediaSrc, type SiteIndex } from "../../lib/site.ts"; +import PageChips from "./PageChips.astro"; import PostThumb from "./PostThumb.astro"; interface Props { @@ -37,7 +37,7 @@ const now = nowStatuses(s, post); {post.title} {post.data.summary &&

{post.data.summary}

} - {links.length ? links.map((l) => {l.label}) : Not tied to a page} + {links.length ? : Not tied to a page} diff --git a/services/site/src/components/library/GameCard.astro b/services/site/src/components/library/GameCard.astro index c81f343..07cfd91 100644 --- a/services/site/src/components/library/GameCard.astro +++ b/services/site/src/components/library/GameCard.astro @@ -25,7 +25,9 @@ const status = site.statusFor(game); // Players and play time sync from BoardGameGeek; nothing shows until they have. const facts = [gamePlayers(game), gamePlayTime(game)].filter(Boolean); const seats = playersOf(game); -const hasPost = site.backlinks(game, { type: "post" }).length > 0; +const post = site.backlinks(game, { type: "post" })[0]; +const postHref = post && site.href(post); +const hasPost = !!post; ---
  • 0; ) } - - BoardGameGeek: {game.title} - + + { + post && postHref && ( + + + Blog: {post.title} + + ) + } + + BoardGameGeek: {game.title} + +
  • @@ -134,10 +146,24 @@ const hasPost = site.backlinks(game, { type: "post" }).length > 0; font-size: 12px; color: var(--gk-muted); } - .bgg { - align-self: flex-start; + .links { margin-top: auto; padding-top: 4px; + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 6px; + } + .blog { + display: inline-flex; + align-items: center; + gap: 6px; + font-size: 13px; + font-weight: 600; + color: var(--gk-teal-bright); + } + .bgg { + align-self: flex-start; font-size: 12px; } diff --git a/services/site/src/lib/world.ts b/services/site/src/lib/world.ts index 59994e0..93f20b6 100644 --- a/services/site/src/lib/world.ts +++ b/services/site/src/lib/world.ts @@ -52,6 +52,12 @@ export function buildLogs(s: SiteIndex, craft: Note<"craft">): Note<"post">[] { return s.backlinks(craft, { type: "post" }) as Note<"post">[]; } +/** The post a make links to: its own build log first, else the newest post about it. */ +export function makeLog(s: SiteIndex, make: Note<"make">): Note<"post"> | undefined { + const posts = s.backlinks(make, { type: "post" }) as Note<"post">[]; + return posts.find((p) => p.data.postType === "build log") ?? posts[0]; +} + /** The tools of a craft, as notes where published, in the craft's order. */ export function toolsOf(s: SiteIndex, craft: Note<"craft">): { title: string; note?: Note<"tool"> }[] { return (craft.data.tools ?? []).map((t) => { diff --git a/services/site/src/pages/workshop/[slug].astro b/services/site/src/pages/workshop/[slug].astro index 85cf169..56619ec 100644 --- a/services/site/src/pages/workshop/[slug].astro +++ b/services/site/src/pages/workshop/[slug].astro @@ -13,7 +13,7 @@ import WorldSection from "../../components/world/WorldSection.astro"; import type { Note } from "../../lib/content.ts"; import { plural, site } from "../../lib/page.ts"; import { formatDate, mediaSrc } from "../../lib/site.ts"; -import { buildLogs, byDateDesc, byOrder, craftPill, craftSeal, makePhotos, makesOf, sentence, toolsOf } from "../../lib/world.ts"; +import { buildLogs, byDateDesc, byOrder, craftPill, craftSeal, makeLog, makePhotos, makesOf, sentence, toolsOf } from "../../lib/world.ts"; const s = await site(); const slug = Astro.params.slug ?? ""; @@ -115,7 +115,7 @@ const postCover = (p: Note<"post">) => mediaSrc((p.data as { cover?: string }).c