--- import BlogLayout from '../../layouts/BlogLayout.astro'; import BlogList from '../../components/blog/BlogList.astro'; import CategoryCard from '../../components/blog/CategoryCard.astro'; import TagCard from '../../components/blog/TagCard.astro'; import Container from '../../components/ui/Container'; import { type BlogPost } from '@/types'; import { useTranslations } from '@/i18n/utils'; import { type Lang } from '@/types/i18n'; import { defaultLang } from '@/i18n/ui'; import { sortPostsByDate } from '@/utils/blog-utils'; // Get current language environment using Astro.currentLocale const lang = Astro.currentLocale as Lang || defaultLang; const t = useTranslations(lang); // Read all blog posts using import.meta.glob const allPosts = await import.meta.glob('./posts/*.md', { eager: true }); // Process blog post data const blogPosts: BlogPost[] = Object.values(allPosts).map((post: any) => { const slug = post.url?.split('/').filter(Boolean).pop() || ''; // Default image if not specified in frontmatter const defaultImage = "https://images.unsplash.com/photo-1516321318423-f06f85e504b3?w=400&h=250&fit=crop&crop=center"; return { title: post.frontmatter.title, description: post.frontmatter.description || '', image: post.frontmatter.image || defaultImage, slug: slug, tags: post.frontmatter.tags || [], tagId: post.frontmatter.tagId || [], category: Array.isArray(post.frontmatter.category) ? post.frontmatter.category : post.frontmatter.category ? [post.frontmatter.category] : [], categoryId: Array.isArray(post.frontmatter.categoryId) ? post.frontmatter.categoryId : post.frontmatter.categoryId ? [post.frontmatter.categoryId] : [], date: post.frontmatter.date || post.frontmatter.pubDate || '', readTime: post.frontmatter.readTime || post.frontmatter.readingTime || '5 min read', }; }); // Sort posts by date const sortedBlogPosts = sortPostsByDate(blogPosts); ---

Our Latest Blog

{t('blog.slogan')} Dive into my thoughts on coding, tech trends, and developer life. Explore my latest posts below.