Repository navigation
feat(blog): add /blog with markdown-sourced static post pages #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9ded6d0
feat(blog): add /blog with markdown-sourced static post pages
alpergundogdu de99c59
fix(blog): correct post 00 date to 2026-05-11
alpergundogdu 9328e28
refactor(footer): extract SiteFooter and mount in layout
alpergundogdu 5721250
refactor(blog): validate frontmatter, stabilise sort, memoise reads
alpergundogdu e01f1bd
docs(blog): drop fortnightly cadence promise from index lede
alpergundogdu df84f5e
feat(blog): publish posts 01 and 02; back-date 00 to sign-off date
alpergundogdu 6d0e82f
docs(blog): reframe graveyard closer around what actually killed prio…
alpergundogdu 35a6ff1
Merge branch 'main' into claude/busy-morse-d37d4b
thiras e1f151d
fix(blog): address review findings
thiras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import type { Metadata, ResolvingMetadata } from "next"; | ||
| import { notFound } from "next/navigation"; | ||
| import { MDXRemote } from "next-mdx-remote/rsc"; | ||
| import remarkGfm from "remark-gfm"; | ||
| import { Frame } from "@/components/ui/Frame"; | ||
| import { Prose } from "@/components/ui/Prose"; | ||
| import { getPost, listPosts } from "@/lib/blog"; | ||
|
|
||
| // Static export: enumerate every slug at build time and refuse anything | ||
| // outside that set. `dynamicParams = false` mirrors the closed-world | ||
| // nature of `output: "export"` — there is no runtime to honour an | ||
| // unknown slug. | ||
| export const dynamicParams = false; | ||
|
|
||
| export function generateStaticParams() { | ||
| return listPosts().map((p) => ({ slug: p.slug })); | ||
| } | ||
|
|
||
| type Params = { slug: string }; | ||
|
|
||
| export async function generateMetadata( | ||
| { params }: { params: Promise<Params> }, | ||
| parent: ResolvingMetadata, | ||
| ): Promise<Metadata> { | ||
| const { slug } = await params; | ||
| const post = getPost(slug); | ||
| if (!post) notFound(); | ||
| // Inherit the root file-convention og image so post shares get the | ||
| // site card instead of a blank one; see app/blog/page.tsx for the | ||
| // pattern and the reason we reuse ogImages for twitter. | ||
| const ogImages = (await parent).openGraph?.images ?? []; | ||
| return { | ||
| title: post.title, | ||
| description: post.summary, | ||
| alternates: { canonical: `/blog/${post.slug}/` }, | ||
| openGraph: { | ||
| title: post.title, | ||
| description: post.summary, | ||
| url: `/blog/${post.slug}/`, | ||
| type: "article", | ||
| publishedTime: post.date, | ||
| images: ogImages, | ||
| }, | ||
| twitter: { | ||
| card: "summary_large_image", | ||
| title: post.title, | ||
| description: post.summary, | ||
| images: ogImages, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| export default async function BlogPost({ | ||
| params, | ||
| }: { | ||
| params: Promise<Params>; | ||
| }) { | ||
| const { slug } = await params; | ||
| const post = getPost(slug); | ||
| if (!post) notFound(); | ||
|
|
||
| return ( | ||
| <main> | ||
| <Frame id="post" tone="paper"> | ||
| <article className="flex flex-col gap-10"> | ||
| <header className="flex flex-col gap-6"> | ||
| <time className="meta opacity-60" dateTime={post.date}> | ||
| {post.date} | ||
| </time> | ||
| <h1 | ||
| className="hug font-semibold leading-[0.95] tracking-[-0.035em]" | ||
| style={{ fontSize: "var(--fs-h2)" }} | ||
| > | ||
| {post.title} | ||
| </h1> | ||
| </header> | ||
|
|
||
| <span aria-hidden className="rule opacity-20" /> | ||
|
|
||
| <Prose> | ||
| <MDXRemote | ||
| source={post.body} | ||
| options={{ mdxOptions: { remarkPlugins: [remarkGfm] } }} | ||
| /> | ||
| </Prose> | ||
| </article> | ||
| </Frame> | ||
| </main> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| import type { Metadata, ResolvingMetadata } from "next"; | ||
| import Link from "next/link"; | ||
| import { Frame } from "@/components/ui/Frame"; | ||
| import { listPosts } from "@/lib/blog"; | ||
|
|
||
| const TITLE = "field notes"; | ||
| const DESCRIPTION = "long-form posts on the deCDN protocol."; | ||
|
|
||
| // Inherit the root file-convention og image (app/opengraph-image.png). | ||
| // Next merges flat fields but shallow-replaces nested objects like | ||
| // `openGraph`, so declaring an `openGraph` here without re-including | ||
| // `images` strips the root image — which previously left every blog | ||
| // route sharing a blank card. We reuse `ogImages` for twitter too: | ||
| // the parent `twitter.images` field is empty here (no app/twitter-image | ||
| // convention exists) and Next's "fall back to og for twitter" only | ||
| // fires at the final resolution step, not via `parent`. | ||
| export async function generateMetadata( | ||
| _: unknown, | ||
| parent: ResolvingMetadata, | ||
| ): Promise<Metadata> { | ||
| const ogImages = (await parent).openGraph?.images ?? []; | ||
| return { | ||
| title: TITLE, | ||
| description: DESCRIPTION, | ||
| alternates: { canonical: "/blog/" }, | ||
| openGraph: { | ||
| title: TITLE, | ||
| description: DESCRIPTION, | ||
| url: "/blog/", | ||
| type: "website", | ||
| images: ogImages, | ||
| }, | ||
| twitter: { | ||
| card: "summary_large_image", | ||
| title: TITLE, | ||
| description: DESCRIPTION, | ||
| images: ogImages, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| export default function BlogIndex() { | ||
| const posts = listPosts(); | ||
|
|
||
| return ( | ||
| <main> | ||
| <Frame id="blog" tone="paper"> | ||
| <header className="flex flex-col gap-6"> | ||
| <span className="meta opacity-60">field notes</span> | ||
| <h1 | ||
| className="hug font-semibold leading-[0.92] tracking-[-0.04em]" | ||
| style={{ fontSize: "var(--fs-h2)" }} | ||
| > | ||
| field notes. | ||
| </h1> | ||
| <p | ||
| className="max-w-[60ch] leading-[1.7] opacity-75" | ||
| style={{ fontSize: "var(--fs-lead)" }} | ||
| > | ||
| long-form posts on the deCDN protocol — what it is, why now, and how | ||
| the pieces fit together. published when something's worth | ||
| saying. | ||
| </p> | ||
| </header> | ||
|
|
||
| <span aria-hidden className="rule mt-16 opacity-20" /> | ||
|
|
||
| {posts.length === 0 ? ( | ||
| <p | ||
| className="mt-16 opacity-60" | ||
| style={{ fontSize: "var(--fs-body)" }} | ||
| > | ||
| nothing yet. | ||
| </p> | ||
| ) : ( | ||
| <ul className="mt-16 flex flex-col divide-y divide-current/15"> | ||
| {posts.map((post) => ( | ||
| <li key={post.slug}> | ||
| <Link | ||
| href={`/blog/${post.slug}/`} | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| className="group grid gap-2 py-8 no-underline @xl:grid-cols-[10rem_1fr] @xl:gap-10" | ||
| > | ||
| <time | ||
| className="meta opacity-60" | ||
| dateTime={post.date} | ||
| style={{ alignSelf: "start" }} | ||
| > | ||
| {post.date} | ||
| </time> | ||
| <div className="flex flex-col gap-3"> | ||
| <h2 | ||
| className="hug font-semibold leading-[1.05] tracking-[-0.025em] group-hover:opacity-80" | ||
| style={{ fontSize: "var(--fs-h3)" }} | ||
| > | ||
| {post.title} | ||
| </h2> | ||
| {post.summary ? ( | ||
| <p | ||
| className="max-w-[60ch] leading-[1.6] opacity-75" | ||
| style={{ fontSize: "var(--fs-body)" }} | ||
| > | ||
| {post.summary} | ||
| </p> | ||
| ) : null} | ||
| </div> | ||
| </Link> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| )} | ||
| </Frame> | ||
| </main> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.