In owolf-dot-com, content lives as MDX files under content/. Locally, the editor writes straight to disk. In production, the editor writes to GitHub through the Contents API, which creates a commit. That commit triggers a Vercel deployment when the repo is connected to the project.
This post covers the production path, the dev path, and how the deploy gets kicked off.
There are two separate flows:
content/ at build time.That split lets the site stay fast and static while still enabling production edits.
Development (local)
content/blog, content/study).Production (deployed)
GITHUB_PAT with Contents read/write permissions.The public blog pages are still built from the repository at deploy time, which keeps them static and fast.
The admin editor calls a server action that writes to GitHub. The implementation uses the Contents API, which creates a commit in the repo.
// src/app/actions/blog/save-post.ts
await createOrUpdateFile(token, "content/blog/my-post.mdx", content, commitMessage);
Under the hood, this is a PUT to:
https://api.github.com/repos/owolfdev/owolfsite/contents/content/blog/my-post.mdx
GitHub creates a commit with the provided message, and that commit becomes the deploy trigger.
The admin edit page now reads from GitHub in production instead of local disk. It fetches the raw MDX file and passes it into the Monaco editor.
// src/app/admin/blog/edit/[slug]/page.tsx
const filePath = `content/blog/${slug}.mdx`;
const mdxSource = await getFileContent(token, filePath);
That ensures the editor always reflects the repo state, not the build artifact.
Vercel deploys on GitHub commits when:
Because the save action creates a real commit on the connected branch, Vercel sees a new commit and kicks off a deployment.
Contents: Read and write for owolfdev/owolfsite.GITHUB_PAT.If you want to test the production flow locally, you can set GITHUB_PAT in .env.local and run with a production build.