fix: resolve translation routing bugs for MDX pages/posts, fix QA smoke tests, and automate target host network cleanup
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Successful in 56s
Build & Deploy / 🏗️ Build (push) Successful in 2m18s
Build & Deploy / 🚀 Deploy (push) Successful in 15s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s

This commit is contained in:
2026-06-10 10:35:06 +02:00
parent 3cbb4ba700
commit d11c27fda0
8 changed files with 138 additions and 11 deletions

View File

@@ -56,9 +56,12 @@ export function isPostVisible(post: { frontmatter: { date: string; public?: bool
return !(postDate > now && config.isProduction);
}
import { mapSlugToFileSlug, mapFileSlugToTranslated } from './slugs';
export async function getPostBySlug(slug: string, locale: string): Promise<PostData | null> {
try {
const filePath = path.join(process.cwd(), 'content', 'posts', `${slug}.mdx`);
const fileSlug = await mapSlugToFileSlug(slug, locale);
const filePath = path.join(process.cwd(), 'content', 'posts', `${fileSlug}.mdx`);
const fileContent = await fs.readFile(filePath, 'utf-8');
const { data, content } = matter(fileContent);
@@ -77,8 +80,10 @@ export async function getPostBySlug(slug: string, locale: string): Promise<PostD
// Not JSON
}
const resolvedSlug = await mapFileSlugToTranslated(fileSlug, locale);
return {
slug,
slug: resolvedSlug,
frontmatter: {
title: data.title || '',
date: data.date || '',
@@ -98,8 +103,10 @@ export async function getPostBySlug(slug: string, locale: string): Promise<PostD
}
export async function getPostSlugs(slug: string, locale: string): Promise<Record<string, string>> {
// Mock function, simply returns the slug for all locales
return { de: slug, en: slug };
const fileSlug = await mapSlugToFileSlug(slug, locale);
const de = await mapFileSlugToTranslated(fileSlug, 'de');
const en = await mapFileSlugToTranslated(fileSlug, 'en');
return { de, en };
}
export async function getAllPosts(locale: string): Promise<PostData[]> {