Skip to content

Commit

Permalink
Merge pull request #103 from JohnsonMao/i18n/update
Browse files Browse the repository at this point in the history
🌐 add slogan and update metadata
  • Loading branch information
JohnsonMao authored Oct 12, 2023
2 parents 852fbbe + 282780a commit d0e72db
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions i18n/locales/en/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const common = {
posts: 'Posts',
about: 'About',
tags: 'Tags',
slogan: 'Making life better, one step at a time',
};

export default common;
4 changes: 2 additions & 2 deletions i18n/locales/en/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const metadata = {
title: "Mao's notes",
description: 'Notes on Learning Front-end Development',
title: "Mao's Corner",
description: "Mao's Learning Corner",
};

export default metadata;
1 change: 1 addition & 0 deletions i18n/locales/zh-TW/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const common = {
posts: '文章',
about: '關於',
tags: '標籤',
slogan: '一步一步,讓生活更美好'
};

export default common;
4 changes: 2 additions & 2 deletions i18n/locales/zh-TW/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const metadata = {
title: "Mao's notes",
description: '學習前端開發的筆記',
title: "Mao's Corner",
description: '阿毛的學習角落',
};

export default metadata;
9 changes: 5 additions & 4 deletions src/app/[lang]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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 List from '@/components/List';
Expand All @@ -19,13 +20,13 @@ export async function generateMetadata({

async function RootPage({ params: { lang } }: RootParams) {
const posts = await getAllDataFrontmatter('posts');
const { metadata } = await getDictionary(lang);
const { common } = await getDictionary(lang);

return (
<Container as="main">
<p className="my-12 text-center text-3xl dark:text-white">
{metadata.title}
</p>
<H1 className="py-12 text-center text-3xl dark:text-white">
{common.slogan}
</H1>
<List Item={Card} items={posts} />
</Container>
);
Expand Down
9 changes: 5 additions & 4 deletions src/app/[lang]/posts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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 List from '@/components/List';
Expand All @@ -19,13 +20,13 @@ export async function generateMetadata({

async function RootPage({ params: { lang } }: RootParams) {
const posts = await getAllDataFrontmatter('posts');
const { metadata } = await getDictionary(lang);
const { common } = await getDictionary(lang);

return (
<Container as="main">
<p className="my-12 text-center text-3xl dark:text-white">
{metadata.title}
</p>
<H1 className="my-12 text-center text-3xl dark:text-white">
{common.slogan}
</H1>
<List Item={Card} items={posts} />
</Container>
);
Expand Down

0 comments on commit d0e72db

Please sign in to comment.