How a post goes from an MDX file to static pages and images. Every snippet here is copied from the repo; open the file named above it to check.
---
title: "Building Agent Memory with Vendor Lock-in Resistance (Part 2)"
slug: {
en: "building-agent-memory-free-vendor",
id: "membangun-agent-memory-bebas-vendor"
}
series: { id: "agent-memory", title: "Building Agent Memory", part: 2 }
---const slugOriginal = data.slug[language];export async function generateBlogPaginationPathsWithLang() {
const _pathsRaw = await Promise.all(Object.keys(I18n)
.map(async(lang) => {
const { pagination } = await getBlogList(lang);
return range(1, pagination.pageCount)
.map(page => ({ page: `${page}`, lang }));
}));
const paths = _pathsRaw.flat(1);
return paths;
};en: 1 posts / 10 = 1 page
/** `/{lang}/blog/{slug}/og.png`: written as a real .png file by the static export */
export const dynamic = 'force-static';
export const dynamicParams = false;
export const generateStaticParams = generateBlogPathsWithLang;
export async function GET(_request: Request, { params }: { params: Promise<{ slug: string; lang: I18nLocales }> }) {
const { slug, lang } = await params;
return renderPostOgImage(slug, lang);
}The real og.png of a post on this site, loaded from its route:
/en/blog/building-agent-memory-free-vendor/og.pngexport async function getSeriesParts(meta: ContentMeta, language = DEFAULT_LOCALE): Promise<ContentMeta[]> {
if (!meta.series?.id) return [];
...
.filter((m) => m.series?.id === meta.series?.id)
.sort((a, b) => (a.series?.part ?? 0) - (b.series?.part ?? 0));const match = /^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(line);
if (!match) continue;
const depth = match[1].length;
const text = toPlainText(match[2]);
const id = slugger.slug(text);
if (depth === 2 || depth === 3) {
items.push({ id, text, depth });
}import generateSitemap from '@/modules/Content/services/sitemap';
export const dynamic = 'force-static';
export default generateSitemap;Runs on every pull request: npm install, then npm run lint.
Run by hand. Deletes everything under gading.dev/media/ on Cloudinary, then uploads every image in public/media, 7 at a time. Banners are served from there in production; in dev they load from public/media directly.
Run by hand. Fetches PageSpeed reports for gading.dev as SVG, desktop and mobile, into public/media/web-reports/pagespeed and commits them.
Run by hand. Runs src/scripts/app:revalidate.ts, which reads every path from sitemap.xml and calls /api/revalidate with them. That route does not exist in src/app today, so this one is a leftover until it comes back.