← cd .. (back to the actual site)
view source ↗/howdidimakethis/blog

$ whoami
> someone reading a post on /blog

$ cat ./README.md | head -2
> a blog with no CMS, no database, and no new GCP resources

$ ./reveal --app=blog
> booting write-up...

The whole feature is a folder of Markdown files.

No third-party CMS, no new storage bucket, no serverless function. Posts are files in this repo, rendered into the same static export as every other page on the site.

$ cat decisions.md

why Markdown-in-repo, not a CMS or an S3 bucket

The original idea was a local desktop app that generates standalone HTML pages and CRUD-manages them in a dedicated S3 bucket, scanned client-side on load. Before building that, four options got laid out — repo-based Markdown won on three counts:

Zero new infrastructure. No extra storage bucket, no new hosting config, no Cloud Function. Publishing a post rides the same GitHub Actions pipeline that already deploys everything else on this site.

Real static HTML, for real link previews. Every post's title, body, and Open Graph tags are fully baked in at build time — not injected client-side — which matters because LinkedIn's link-preview scraper doesn't execute JavaScript. A client-scanned S3 bucket would've needed extra work to make individual posts crawlable at all.

Free consistency with the theme system. A post rendered through this site's own layout inherits the magazine/pixel/material/monochrome switcher automatically. A standalone HTML file generated by an external tool would have to duplicate that chrome, or drift from it the first time the site's design changes and old posts don't get regenerated.

The honest trade-off: publishing means a git commit and a CI build (a minute or two of lag), not an instant edit. For a personal blog, that's a fair price.

$ cat pipeline.md

from Markdown file to deployed page

There's no request-time backend here — the interesting part of this architecture is a build-time pipeline, feeding infrastructure that already existed. Nothing new got provisioned in GCP for this feature at all.

build time — `next build`content/blog/*.mdMarkdown +YAML frontmatterlib/blog/posts.tsgray-matter → frontmatterremark + remark-gfm → HTML(sanitize: false — trusted author)next buildgenerateStaticParams —one route per post + taggenerateMetadata —Open Graph tags baked inoutput: "export"already exists — nothing new provisionedFirebase Hostingthe same Firebase Hosting sitethat serves the rest of ch-ai.indeployed by the existing GitHub Actions pipelinerequest time — a visitor's browservisitor/blog, /blog/[slug],/blog/tags/[tag]fully static HTMLBlogIndexclient-side search + "Load more"runs after load — no round triplinkedin.com/sharingshare-offsite dialog, new tabno API key · no OAuthShare button click

Everything above the dashed box happens once, during next build. Everything below it is what a visitor's browser actually does — fetch static HTML, then run a small amount of client-side JS for search and pagination.

$ cat lib/blog/posts.ts | grep export

the render pipeline, in order

1. gray-matter splits a .md file into YAML frontmatter (title, date, excerpt, tags, an optional draft flag) and the Markdown body.
2. Listing posts (getAllPosts, the index, tag pages) only ever reads frontmatter — the Markdown body is never parsed for a post that isn't being fully rendered, so the index doesn't pay for content it isn't showing.
3. Rendering one post (getPostBySlug) runs the body through remark + remark-gfm + remark-html, with sanitize: false — posts are self-authored and trusted, the same model as the rest of the site, so raw HTML written inline in a post (an embedded YouTube <iframe>, say) passes straight through.
4. generateStaticParams turns every published slug and tag into a route at build time — required by output: "export", since every path has to be known before the static files exist. A draft or an unpublished slug simply isn't a route; it 404s.
5. generateMetadata sets each page's title, description, and Open Graph tags — this is what the LinkedIn share button's preview card actually reads.
$ cat components/blog/BlogIndex.tsx | grep client

tags, search, and pagination — all client-side, no new dependency

getAllPosts() already runs at build time and its result gets passed straight into <BlogIndex posts={posts} />, a small "use client" component. Since that array is already sitting in the browser, three features fell out of it for close to free:

Search is a plain .filter() over title, excerpt, and tags as you type — no search index file, no API route, no library. Fine at personal-blog scale; the point to reach for a build-time tool like Pagefind instead is if post bodies (not just excerpts) need to be searched, or the post count grows enough that shipping the whole list client-side stops being free.

Tags reuse the same frontmatter field the Markdown pipeline already parses. getAllTags()/getPostsByTag() feed a /blog/tags/[tag] static route — which just renders <BlogIndex> again, pre-filtered. A tag page isn't a separate implementation; it's the index, scoped.

Pagination is "Load more", not /blog/page/2 routes — the full list already has to be client-side for search to work, so slicing it further costs nothing extra, and a blog index's pagination state isn't something worth its own crawlable URL. Individual posts are what get shared and indexed, not the index's page 2.

$ cat components/LinkedInShareButton.tsx

the LinkedIn button is a link, not an integration

"Publish to LinkedIn via a button" could mean two very different things: a share-intent link, or a full API integration with a registered LinkedIn app, OAuth consent, and token storage. This is the first one — an anchor tag pointed at LinkedIn's own share-offsite URL, opened in a new tab. No credentials to manage, no token to refresh, nothing that can expire. The preview card it shows comes entirely from the generateMetadata Open Graph tags above.

$ ls content/blog/

stack

Next.js static export (output: "export")gray-matter — frontmatter parsingremark + remark-gfm + remark-htmlgenerateStaticParams / generateMetadataClient-side search & "Load more" — no new dependencyLinkedIn share-offsite link