--- import { type Lang } from '@/i18n/utils'; import { defaultLang } from '@/i18n/ui'; import { getBlogBaseUrl, extractCategories } from '@/utils/blog-utils'; // Define component props interface Props { lang?: Lang; currentCategory?: string; } // Get component props const { lang = defaultLang, currentCategory = '' } = Astro.props; // Determine base URL path const baseUrl = getBlogBaseUrl(lang); // Read all blog posts - choose different static paths based on language const postsGlob = { en: await import.meta.glob('/src/pages/blog/posts/*.md', { eager: true }), zh: await import.meta.glob('/src/pages/zh/blog/posts/*.md', { eager: true }) }; // Get posts for current language const allPosts = lang === 'zh' ? Object.values(postsGlob.zh) : Object.values(postsGlob.en); // Extract categories from posts const categoryMap = extractCategories(allPosts); // Convert to array and sort const categories = Array.from(categoryMap.keys()).sort(); // Multilingual titles const titles = { en: 'Categories', zh: '分类' }; // Get title for current language const title = titles[lang] || titles[defaultLang]; ---