
From Next.js + MDX to EmDash + Astro
Editing My Portfolio Without Deploying Every Change
Dec 5, 2026
For a long time my portfolio ran on Next.js with MDX for the blog. It worked, but every small change followed the same loop: open the code editor, find the right file, write the change, commit, deploy, and then check if it looked right. Fixing a typo in a blog post took as long as shipping a feature.
This article explains how I got out of that loop, why I chose EmDash on top of Astro, and how I solved the one problem that nearly stopped me: a portfolio that has to exist in two languages.
The problem: editing code to edit content
With MDX, a blog post is a file in the repository. That is great for developers, but it means the author needs:
- A code editor open
- Knowledge of the project structure
- A build and deploy to see the result

Every small content change went through code, git, and a deploy.
I wanted the opposite: a visual editor where I could change text, add an image, and see the result on the real site.
Looking for a visual alternative
I compared headless CMS options and page builders. Most of them either lived outside my code (so the content was far from the layout) or felt heavy for a personal site.
Then I found EmDash in the Astro documentation. It is a CMS built for Astro, with a full admin UI, and it stores content in a database instead of in files. The admin lives next to the site, so editing feels like editing a website, not a repository.
That was the moment I decided to move.
The migration: Next.js to Astro
The migration was done in November 2026. The commit message in my repository says it plainly: revamp v2 from nextjs to astro.
Astro was a good fit for a portfolio that is mostly content. Pages are server-rendered, and React is used only as small interactive islands.
The main configuration lives in astro.config.mjs. This is where EmDash is registered:
import { defineConfig } from "astro/config";
import emdash, { local } from "emdash/astro";
import { libsql, sqlite } from "emdash/db";
export default defineConfig({
output: "server",
integrations: [
emdash({
database: sqlite({ url: "file:./data.db" }),
storage: local({
directory: "./uploads",
baseUrl: "/_emdash/api/media/file",
}),
}),
],
});With this in place, the admin is available at /_emdash/admin while developing. Content is saved to the database, and the site reads it when a page is rendered. No redeploy is needed for a text change.

The dashboard. Drafts, media, and recent edits sit next to the site, so a change does not start in a code editor.
Tip: On Vercel I switched the database to Turso (libSQL) and the uploads to Cloudflare R2. The same emdash() integration accepts both, so the rest of the code does not change.The real problem: two languages
My portfolio is bilingual: English and French. Before EmDash, I handled this with separate content for each language, and every new blog post meant writing it twice.
In Astro, the language routing is one setting:
export default defineConfig({
i18n: {
defaultLocale: "en",
locales: ["en", "fr"],
routing: {
prefixDefaultLocale: true,
},
},
});Now the URLs look like /en/blog/my-post and /fr/blog/my-post. Routing was the easy part.
The hard part was content. Writing every post twice by hand is slow, and I did not want to maintain two copies of everything. I wanted to write in one language and have the other one generated.
Discovering that EmDash can be extended
EmDash supports plugins. A plugin can add hooks, API routes, and panels inside the admin. I checked the plugin docs and saw that a plugin could add an editor panel next to a post.
That was the idea: a panel called Translate, inside the post editor, that sends the saved content to a translation service and creates a draft in the other locale.
The service I already knew was DeepL, which has good quality for European languages, especially French.
So I built it.
Introducing plugin-emdash-translator
The plugin translates content field by field. It does not send the whole post as one blob. It reads the collection schema, finds the translatable fields, and sends only those.
The plugin is published on npm, so installing it takes one command in the site folder:
pnpm add plugin-emdash-translatorThen register it in astro.config.mjs. The registration is one line:
import { translatorPlugin } from "plugin-emdash-translator";
emdash({
plugins: [highlightjsPlugin(), translatorPlugin()],
});The workflow inside the admin:
- Open a post in the EmDash admin.
- Expand the Translate panel in the sidebar.
- Choose the target locale, for example
fr. - Optionally turn on Overwrite existing translation.
- Click Translate with DeepL.


The Translate panel in the sidebar of the post editor. It shows which locales are missing and lets you pick the target.
The plugin then creates a draft in the target locale, linked to the original entry. I review the draft and publish it.
How the translation flow works

What gets translated (and what does not)
Not every field should be translated. Images, slugs, and dates should stay as they are. The plugin handles this with a few rules:
string,text, andportableTextfields are translated- Image
alttext is translated - Text subfields inside repeaters are translated
- SEO title and description are translated
- Fields listed under Do not translate are skipped
The Do not translate list is a plugin setting, so it can be changed in the admin without touching code.
Keeping formatting safe
Blog posts use Portable Text, which keeps marks such as bold, italic, and links. Inline code is the tricky part. If DeepL sees const x = 1 it may "translate" the code.
The plugin wraps inline code in XML tags and tells DeepL to ignore them:
body.tag_handling = "xml";
body.split_sentences = "nonewlines";
// Inline code spans are wrapped as <cN>…</cN> by the PT encoder.
body.ignore_tags = ["c"];The code inside the tags stays intact, and the surrounding text is translated normally.
Talking to DeepL safely
The DeepL provider has a few details that matter in practice.
Free and Pro keys use different endpoints. Free keys end in :fx, so the plugin picks the host from the key:
export function deeplHost(apiKey: string): string {
return apiKey.trim().endsWith(":fx") ? DEEPL_FREE_HOST : DEEPL_PRO_HOST;
}DeepL has request limits. A request can hold at most 50 texts and about 128 KiB. The plugin splits long lists into batches that stay under these limits.
Retries are built in. Rate limits (HTTP 429) and server errors (5xx) are retried with exponential backoff, and quota and auth errors are shown clearly in the panel.
The plugin only asks for what it needs. In createPlugin() it declares its capabilities and the only hosts it may call:
capabilities: ["content:write", "schema:read", "network:request"],
allowedHosts: ["api.deepl.com", "api-free.deepl.com"],Settings you can change in the admin
The plugin exposes its options in the EmDash settings screen:
Setting | Purpose |
|---|---|
Formality |
|
Locale map | Region overrides, for example |
Collections | Which collections show the panel (default |
Do not translate | Field names to leave alone |
The API key can come from the environment variable DEEPL_API_KEY or be pasted into the settings screen.
Gotchas I ran into
"Vite module runner has been closed" in development. EmDash writes to data.db when you save in the admin. If Vite watches that file, a hot reload can interrupt a save. The fix is to ignore the database and uploads in the Vite config:
vite: {
server: {
watch: {
ignored: [
"**/data.db",
"**/data.db-*",
"**/uploads/**",
"**/.emdash/**",
],
},
},
},Plugins go in plugins: []. Native plugins like the translator belong in the plugins array, not in sandboxed.
Cache is fast, but edits take a minute. Public pages are cached on the CDN for 60 seconds, then served stale while revalidating. A saved edit can take up to a minute to show on the live site. For most blog work this is fine, and it keeps the database calm.
The result
Here is the new workflow for a blog post:
Step | Before (Next.js + MDX) | Now (EmDash + Astro) |
|---|---|---|
Write a post | Edit an MDX file in the code editor | Write in the visual admin |
See the result | Run the dev server or deploy | Preview in the browser |
Add French | Write a second MDX file by hand | Click Translate with DeepL, then review |
Publish | Commit, push, deploy | Click publish |
I still review every translation before publishing. DeepL is very good, but a portfolio is personal, so the final words should be mine.

The same article served in both languages: /en/blog/... and /fr/blog/....
Lessons learned
- Look for the friction first. The reason I moved was not the framework. It was the loop of editing code to change content.
- Check the extension points. A CMS that can be extended saved me from building a separate translation tool.
- Keep translation human-reviewed. Automation saves time, but the draft step matters.
- Start with a small plugin. My translator started as one panel and a few functions. It can grow later.
Try it yourself
- EmDash: the CMS built on Astro (see the Astro documentation)
- DeepL API: create a key at deepl.com/pro-api (free keys end in
:fx) - Astro i18n: the official routing guide for multiple locales
If you are moving a portfolio from Next.js to Astro, start with the content model. Once your content lives in a CMS, the rest of the migration becomes much easier.