IkboljonMe
Записи

09.05.26На английском3 мин чтенияNotion · Next.js

Why my blog lives in Notion

I wanted to write where I already think. So the site reads posts straight from a Notion database — no export step, no markdown files in the repo.


Why my blog lives in Notion

I already plan projects, keep notes and draft ideas in Notion. Every time I set up a blog with markdown files in a repository, the same thing happened: the writing lived in one place and the drafts in another, and the friction was enough that I stopped posting. So for ikboljon.me I flipped it around. The blog is a Notion database, and the site reads from it.

How a post gets from Notion to the page

Each post is a page in a database with a handful of columns: Title, Slug, Summary, Date, Tags, Language and a Status select. The site only asks for pages where Status is Published, sorted by date, so a draft can sit there for weeks without leaking.

When someone opens a post, the site fetches that page's blocks and renders each one as real HTML — headings, lists, quotes, code, images, tables, toggles. There is no Notion wrapper library in between; it is one TypeScript switch over the block types, plus one pass that groups consecutive list items into a single list.

Two things that surprised me

The first was the new Notion API model. In the current SDK a database is no longer queried directly — it holds one or more data sources, and you query those. The site keeps working with the database ID I paste into the config and resolves it to its data source once, on the first request.

typescript
const db = await notion.databases.retrieve({ database_id })
const dataSourceId = db.data_sources[0].id

const rows = await notion.dataSources.query({
  data_source_id: dataSourceId,
  filter: { property: "Status", select: { equals: "Published" } },
  sorts: [{ property: "Date", direction: "descending" }],
})

The second was images. Files uploaded to Notion are served from signed URLs that expire after about an hour. If a page is cached for a day, its images break long before the page does. So every page that reads Notion revalidates hourly — the cache never outlives the links inside it.

Publishing without waiting

Hourly is fine for most edits, but when I publish something I want it live now. The site has a small revalidate endpoint protected by a secret; calling it refreshes the home page, the blog index and the post itself.

Was it worth it

So far, yes. Writing a post is now the same motion as writing a note: open Notion, type, flip the status. The site is just the place where the finished ones show up.