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
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:
13
lib/slugs.ts
13
lib/slugs.ts
@@ -31,6 +31,11 @@ export async function mapSlugToFileSlug(translatedSlug: string, locale: string):
|
||||
return slugs.categories[translatedSlug as keyof typeof slugs.categories];
|
||||
}
|
||||
|
||||
// Check posts
|
||||
if ((slugs as any).posts && translatedSlug in (slugs as any).posts) {
|
||||
return (slugs as any).posts[translatedSlug];
|
||||
}
|
||||
|
||||
// Return original slug if no mapping found
|
||||
return translatedSlug;
|
||||
}
|
||||
@@ -45,7 +50,7 @@ export async function mapFileSlugToTranslated(fileSlug: string, locale: string):
|
||||
const messages = getMessages(locale);
|
||||
const slugs = messages.Slugs;
|
||||
|
||||
const sections = [slugs.pages, slugs.products, slugs.categories];
|
||||
const sections = [slugs.pages, slugs.products, slugs.categories, (slugs as any).posts];
|
||||
|
||||
for (const sectionData of sections) {
|
||||
if (sectionData && typeof sectionData === 'object') {
|
||||
@@ -63,16 +68,16 @@ export async function mapFileSlugToTranslated(fileSlug: string, locale: string):
|
||||
|
||||
/**
|
||||
* Gets all translated slugs for a section
|
||||
* @param section - The section name (pages, products, categories)
|
||||
* @param section - The section name (pages, products, categories, posts)
|
||||
* @param locale - The current locale
|
||||
* @returns Object mapping translated slugs to file slugs
|
||||
*/
|
||||
export async function getSlugMappings(
|
||||
section: 'pages' | 'products' | 'categories',
|
||||
section: 'pages' | 'products' | 'categories' | 'posts',
|
||||
locale: string,
|
||||
): Promise<Record<string, string>> {
|
||||
const messages = getMessages(locale);
|
||||
const sectionData = messages.Slugs[section];
|
||||
const sectionData = (messages.Slugs as any)[section];
|
||||
|
||||
if (sectionData && typeof sectionData === 'object') {
|
||||
return sectionData as Record<string, string>;
|
||||
|
||||
Reference in New Issue
Block a user