diff --git a/messages/en.json b/messages/en.json index c485c97..6f7e389 100644 --- a/messages/en.json +++ b/messages/en.json @@ -66,7 +66,7 @@ "BlogPage": { "title": "Blog", "subtitle": "Latest news and updates from our team", - "publisher": "Publisher", + "author": "Author", "categories": "Categories", "tableOfContents": "Table of Contents", "all": "All", diff --git a/messages/zh.json b/messages/zh.json index 6de5f6b..6b459fa 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -66,7 +66,7 @@ "BlogPage": { "title": "博客", "subtitle": "来自我们的团队最新新闻和更新", - "publisher": "发布者", + "author": "作者", "categories": "分类", "tableOfContents": "目录", "all": "全部", diff --git a/src/app/[locale]/(marketing)/blog/[...slug]/page.tsx b/src/app/[locale]/(marketing)/blog/[...slug]/page.tsx index 782558c..e1452e3 100644 --- a/src/app/[locale]/(marketing)/blog/[...slug]/page.tsx +++ b/src/app/[locale]/(marketing)/blog/[...slug]/page.tsx @@ -7,10 +7,11 @@ import { getBaseUrl } from '@/lib/urls/get-base-url'; import { estimateReadingTime, getLocaleDate } from '@/lib/utils'; import type { NextPageProps } from '@/types/next-page-props'; import { allPosts } from 'content-collections'; +import { CalendarIcon, ClockIcon } from 'lucide-react'; import type { Metadata } from 'next'; +import { getTranslations } from 'next-intl/server'; import Image from 'next/image'; import { notFound } from 'next/navigation'; -import { getTranslations } from 'next-intl/server'; import '@/styles/mdx.css'; @@ -35,28 +36,28 @@ async function getBlogPostFromParams(props: NextPageProps) { if (!params) { return null; } - + const locale = params.locale as string; const slug = (Array.isArray(params.slug) ? params.slug?.join('/') : params.slug) || ''; - + // Find post with matching slug and locale const post = allPosts.find( - (post) => - (post.slugAsParams === slug || (!slug && post.slugAsParams === 'index')) && + (post) => + (post.slugAsParams === slug || (!slug && post.slugAsParams === 'index')) && post.locale === locale ); - + if (!post) { // If no post found with the current locale, try to find one with the default locale const defaultPost = allPosts.find( - (post) => + (post) => (post.slugAsParams === slug || (!slug && post.slugAsParams === 'index')) ); - + return defaultPost; } - + return post; } @@ -115,8 +116,14 @@ export default async function BlogPostPage(props: NextPageProps) { {/* blog post date */}
{date}
-{estimateReadingTime(post.body.raw)}
+{date}
+{estimateReadingTime(post.body.raw)}
+