me: can u build https://github.com/brightmann/nbtn?
nbtn is a fresh Next.js 12 blog starter with Notion added — basically create-next-app plus @notionhq/client, one commit, named blog_app. It also has a .env file committed in the repo.
One thing, though: the content failed an execution-risk check when I pulled it, so I can't install or build it as-is — processing it could run code from the repo. Do you want me to go ahead with it anyway?
nbtn builds — with two small fixes: the homepage was server-side rendered, so I changed it to static props for export, and images are now unoptimized. Dependencies installed, and a test build compiles fine — it only fails at the Notion call, because the .env in the repo holds just 2-character placeholders, no real key or database.
So it needs a real Notion setup: an integration key (NOTION_KEY) and a database (NOTION_DATABASE) whose rows have a Name title and a cover image. Same kind of setup as snbn, just simpler — no token_v2 needed here.
Want me to create a fresh integration + database for it, or point it at one of your existing databases?
me: what's the difference between NOTION_TOKEN and NOTION_KEY?
No real difference — they're two names for the same kind of value: a Notion integration's secret token, passed to @notionhq/client as the auth token.
Each template just picked its own name:
- nbtn reads
NOTION_KEY - snbn and rw read
NOTION_TOKEN - nnbb reads
NOTION_API_INTEGRATION_SECRET
Same credential, different label. One integration's secret could fill any of them.
The one that's actually different is NOTION_TOKEN_V2 (nnbb, ijjk-nb) — that's your browser session cookie, not an integration secret.
me: Create a new Notion setup for nbtn.
Setting up the Notion side for nbtn now — new integration, database, and a test post. I'll build and deploy once that comes back.
nbtn's Notion setup is done and the build is verified. Integration "nbtn-blog" and database "nbtn Blog Posts" are live, with a Test Post carrying the coffee cover — and the local static export renders it: homepage shows the post and cover, post page works. The fixes are committed locally (9f49f74): static props instead of server-side, plain <img> instead of next/image (Next 12.1's export rejects the default image loader), API stub removed, plus the Workers and Pages workflows.
To go live I need two things from you:
- a fresh PAT for brightmann/nbtn, with Contents + Workflows + Secrets — so I can push and set the repo secrets myself
- a Cloudflare token (Edit Cloudflare Workers template) for the
CLOUDFLARE_API_TOKEN secret.
me: the github pat here...
Pushed — commit 9f49f74 is on main, remote restored. Both workflows ran, and both failed for one reason only: the two Notion secrets are empty (the log shows blank values, then the same "Invalid request URL" my dummy-env test had). The code itself compiles fine on the runners.
The PAT you pasted can't set secrets (no Secrets scope) and can't enable Pages (no Administration scope), so two quick steps from you in the repo Settings:
Secrets → Actions → New repository secret:
Pages → Build and deployment → GitHub Actions (same as you set for nbl/snbn)
Once those are in, I'll re-run both workflows and verify the live sites. The PAT stays valid until then — I'll tell you when it can be revoked.
me: NOTION_DATABASE is not set as NOTION_DATABASE_ID like before?
Right — the name just has to match what the code reads. nbtn's code uses process.env.NOTION_DATABASE, while snbn and rw's code reads NOTION_DATABASE_ID. Same kind of value (the database ID), different label per template.
me: NOTION_DATABASE and NOTION_KEY need adding as repo secret?
Yes — the workflows read them from repo secrets, and the runners can't see anything else. That's why both runs failed with blank values. Same as the CLOUDFLARE_API_TOKEN you already added. Once they're in, I'll re-run both workflows.
me: done.
GitHub Pages is live: https://brightmann.github.io/nbtn/ — homepage shows Test Post with the coffee cover, post page loads. Push-to-live works there now.
Workers is blocked on the token: the deploy failed with a Cloudflare auth error — the token is missing User → User Details → Read, which wrangler needs to resolve the account. Fix it on the dashboard (Profile → API Tokens → edit the token → add User Details: Read), or create a fresh one from the "Edit Cloudflare Workers" template and update the repo secret. Once that's done, tell me and I'll trigger the deploy again.
me:
me: what to do?
That red error is the problem: the token has a Zone policy with an empty row ("Choose a zone resource"), and a Workers deploy token doesn't need zone access at all. Do this:
- Click the red trash icon on the Edit Zone policy block to delete the whole thing.
- Add the account as the resource instead — an Account policy scoped to Luckypoem@gmail.com's Account.
- In the permission groups below, make sure these two are checked:
- Workers Scripts → Edit (under Account / Developer Platform)
- User Details → Read (under User — this is the one wrangler complained about)
- Save. Editing keeps the same token value, so the GitHub secret stays valid — no need to update it.
If the screen fights back, the simpler path is to delete this token and create a fresh one from the "Edit Cloudflare Workers" template, which has exactly those permissions and no zone policy — then update the repo secret with the new value.
Tell me when it's saved and I'll re-trigger the deploy.
me: done.
nbtn is live on both surfaces, verified:
Your token fix worked — the last failure was just the missing compatibility_date in the config, which I added. Both workflows are green now, so pushes auto-deploy.
The PAT can be revoked now — all pushes are done. One thing to remember: adding a row in the Notion database alone doesn't rebuild the site; re-run a workflow (or push anything) to put a new post live.
In Notion, on your database page: click the + at the right end of the table header, name it Slug, type Text.
One catch, though: nbtn doesn't use slugs — its post URLs are the Notion page IDs (/posts/42063c58-...). A Slug column would just sit there unused unless I change the code to build routes from it. Want me to wire that in so posts live at /posts/<slug>?
me: yes.
Slug code is in and builds clean — with no Slug column yet it falls back to the page ID, exactly as designed. I'm waiting on the Notion column now; once it's set I'll verify /posts/test-post renders and push it live.
Slugs are live on both surfaces — Test Post is now at /posts/test-post, homepage links to it, verified on Workers and Pages.
One note: you'd already added the column yourself as lowercase slug — I renamed it to Slug, since the code reads that exact name. The old /posts/<page-id> URL now 404s, and any post without a slug still falls back to its page ID.
Fixed — the template only put the title in the browser tab (<title>), never as a heading on the page itself. It now renders as a visible <h1>, verified live on both surfaces for Test Post and 战马.
While fixing it I found a second bug: your new 战马 post has no cover, and the homepage crashed the whole build on it (Cannot read properties of null). The homepage now skips the image when a post has no cover, so cover-less posts work fine.
me: can u just strip the cover image from all posts?
me: and in the post https://brightmann.github.io/nbtn/posts/fh , it shows 'Undefined type'. what does it mean? pls fix it.
Both done and verified live.
Covers are stripped — 0 images on both homepages, posts are title-only now.
"Undefined type" meant the post had a block type the template didn't know how to render. 战马's body is a YouTube video, and the template had no video case, so it printed that fallback text. Video and embed blocks now render as a real YouTube player, and anything else unknown just renders its text (or nothing) instead of that message — checked live on both surfaces, the video plays as an embed and the text is gone.
me: the post https://brightmann.github.io/nbtn/posts/ce can't show the full content.
Fixed — Notion only returns 100 blocks per request, and ce has 945, so the template was only ever fetching the first 100 and the rest never made it to the page. The code now pages through all of them.
Verified live on both surfaces: /posts/ce shows all 945 paragraphs, right down to the last line "这种现象,是不是很耐人寻味?"
me: can make https://brightmann.github.io/nbtn support pagination?
Done — pagination is live on both surfaces, same shape as your other blogs: 5 per page, newest first, numbered pager Previous | 1 | 2 | Next (hidden when there's only one page).
With your 6 posts now, the homepage shows the newest 5 and Test Post sits on /page/2. /page/1 sends you back home.
得到的博客地址:
https://brightmann.github.io/nbtn/
https://nbtn.luckypoem.workers.dev
项目地址:
https://github.com/kimkimani/nextjs-blog-app-using-typescript-and-notion
https://github.com/brightmann/nbtn
源帖是在app.notion.com(我是用brightmann@gmail.com + 邮箱验证码登录的。)里面创建的。创建源帖后,还需修改一下仓库https://github.com/brightmann/nbtn里面的代码,比如修改package.json,在文件的最下一行,回车,然后点击commit changes.
仓库代码发生变化后,就会触发平台github pages/cloudflare workers自动重建博客程序,耗时约2分钟。2分钟后,博客就会更新。