diff --git a/i18n/locales/en/common.ts b/i18n/locales/en/common.ts index e7a241a..a3d012c 100644 --- a/i18n/locales/en/common.ts +++ b/i18n/locales/en/common.ts @@ -3,7 +3,7 @@ const common = { posts: 'Posts', about: 'About', tags: 'Tags', - slogan: 'Making life better, one step at a time', + categories: 'Categories', }; export default common; diff --git a/i18n/locales/en/metadata.ts b/i18n/locales/en/metadata.ts index 25ad9ca..5baf243 100644 --- a/i18n/locales/en/metadata.ts +++ b/i18n/locales/en/metadata.ts @@ -1,6 +1,6 @@ const metadata = { title: "Mao's Corner", - description: "Mao's Learning Corner", + description: "Welcome to Mao's Learning Corner, where I document my study notes. Looking forward to exploring the vast realms of knowledge together with you.", }; export default metadata; diff --git a/i18n/locales/zh-TW/common.ts b/i18n/locales/zh-TW/common.ts index 8740745..38b3204 100644 --- a/i18n/locales/zh-TW/common.ts +++ b/i18n/locales/zh-TW/common.ts @@ -3,7 +3,7 @@ const common = { posts: '文章', about: '關於', tags: '標籤', - slogan: '一步一步,讓生活更美好' + categories: '分類', }; export default common; diff --git a/i18n/locales/zh-TW/metadata.ts b/i18n/locales/zh-TW/metadata.ts index b3c408a..88592f5 100644 --- a/i18n/locales/zh-TW/metadata.ts +++ b/i18n/locales/zh-TW/metadata.ts @@ -1,6 +1,6 @@ const metadata = { title: "Mao's Corner", - description: '阿毛的學習角落', + description: '歡迎來到阿毛的學習角落,這裡記錄著我的學習筆記,期待與你一同探索廣闊的知識領域。', }; export default metadata; diff --git a/src/app/[lang]/page.tsx b/src/app/[lang]/page.tsx index fe72400..2604fb4 100644 --- a/src/app/[lang]/page.tsx +++ b/src/app/[lang]/page.tsx @@ -14,19 +14,20 @@ export async function generateMetadata({ const { common } = await getDictionary(lang); return { - title: common.posts, + title: common.home, }; } async function RootPage({ params: { lang } }: RootParams) { const posts = await getAllDataFrontmatter('posts'); - const { common } = await getDictionary(lang); + const { metadata } = await getDictionary(lang); return ( -

- {common.slogan} +

+ {metadata.title}

+

{metadata.description}

); diff --git a/src/app/[lang]/posts/[postId]/page.tsx b/src/app/[lang]/posts/[postId]/page.tsx index 33dbe0e..4a8d362 100644 --- a/src/app/[lang]/posts/[postId]/page.tsx +++ b/src/app/[lang]/posts/[postId]/page.tsx @@ -2,6 +2,7 @@ import type { Metadata } from 'next'; import { notFound } from 'next/navigation'; import Container from '@/components/Container'; +import { H1 } from '@/components/Heading'; import Link from '@/components/Link'; import TableOfContents from '@/components/TableOfContents'; import Comment from '@/components/Comment'; @@ -38,13 +39,14 @@ async function PostPage({ params: { postId } }: PostParams) { return ( <> - -

{frontmatter.title}

-

{formattedDate}

-
{content}
+ +

+ {frontmatter.title} +

+ +
+ {content} +
回首頁
diff --git a/src/app/[lang]/posts/page.tsx b/src/app/[lang]/posts/page.tsx index 2f8448e..4a5f7b2 100644 --- a/src/app/[lang]/posts/page.tsx +++ b/src/app/[lang]/posts/page.tsx @@ -1,9 +1,9 @@ import type { Metadata } from 'next'; import { getDictionary } from '~/i18n'; -import { H1 } from '@/components/Heading'; import Card from '@/components/Card'; import Container from '@/components/Container'; +import { H1 } from '@/components/Heading'; import List from '@/components/List'; import { getAllDataFrontmatter } from '@/utils/mdx'; import type { RootParams } from '../layout'; @@ -20,13 +20,14 @@ export async function generateMetadata({ async function RootPage({ params: { lang } }: RootParams) { const posts = await getAllDataFrontmatter('posts'); - const { common } = await getDictionary(lang); + const { metadata } = await getDictionary(lang); return ( -

- {common.slogan} +

+ {metadata.title}

+

{metadata.description}

); diff --git a/src/components/Header/Logo.tsx b/src/components/Header/Logo.tsx index c07753a..fc1ae01 100644 --- a/src/components/Header/Logo.tsx +++ b/src/components/Header/Logo.tsx @@ -12,8 +12,15 @@ export type LogoProps = { }; function Logo({ src, alt, scrollY, scrollThreshold }: LogoProps) { - const translateY = clamp(scrollY * -1, scrollThreshold * -1) + scrollThreshold; - const scale = 1.5 - clamp(scrollY, scrollThreshold) / (scrollThreshold * 2); + const translateY = ( + clamp(scrollY * -1, scrollThreshold * -1) + scrollThreshold + ).toFixed(2); + + const scale = ( + 1.5 - + clamp(scrollY, scrollThreshold) / (scrollThreshold * 2) + ).toFixed(2); + const style = { '--tw-translate-y': `${translateY}px`, '--tw-scale-x': scale, @@ -23,7 +30,7 @@ function Logo({ src, alt, scrollY, scrollThreshold }: LogoProps) { return (