Skip to content

Commit 7837701

Browse files
committed
feat(site): add Chinese community page
1 parent 438dd32 commit 7837701

File tree

6 files changed

+32
-1
lines changed

6 files changed

+32
-1
lines changed

.knosys/sites/default/astro.config.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default defineConfig({
3434
],
3535
components: {
3636
SiteTitle: './src/shared/controls/astro-brand-logo',
37+
SocialIcons: './src/entry/layouts/default/NavMenu.astro',
3738
},
3839
sidebar: [
3940
{

.knosys/sites/default/src/domain/post/widgets/post-card/PostCard.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ function PostCardWidget({ dataSource, className, headerClassName, bodyClassName,
1919
<span className="text-lg/tight font-semibold">{dataSource.title}</span>
2020
</CardHeader>
2121
<CardBody className={clsx('py-0 text-sm font-light break-all', bodyClassName)}>{dataSource.description || 'No description'}</CardBody>
22-
<CardFooter className={footerClassName}>{dataSource.date.toLocaleDateString()}</CardFooter>
22+
<CardFooter className={footerClassName}>
23+
{[dataSource.date.getFullYear(), (dataSource.date.getMonth() + 1), dataSource.date.getDate()].join('-')}
24+
</CardFooter>
2325
<a
2426
className="absolute inset-0 z-50"
2527
href={dataSource.url}

.knosys/sites/default/src/entry/layouts/default/NavMenu.astro

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const getLocaleUrl = getRelativeLocaleUrl.bind(null, locale);
1818
const navs: SiteNav[] = [
1919
{ key: 'guides', path: '/guides' },
2020
];
21+
22+
if (locale === 'zh') {
23+
navs.push({ key: 'community', path: '/community' });
24+
}
2125
---
2226

2327
<div class="internal-links">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
import StarlightLayout from '@astrojs/starlight/components/StarlightPage.astro';
3+
---
4+
5+
<StarlightLayout
6+
frontmatter={{ title: "社区" }}
7+
sidebar={[
8+
{
9+
label: '关于',
10+
items: [
11+
{ label: '社区', link: '/community/' },
12+
],
13+
}
14+
]}
15+
headings={[
16+
{ depth: 2, slug: '讨论群组', text: '讨论群组' },
17+
]}
18+
>
19+
<h2>讨论群组</h2>
20+
<p>为方便大家能够及时交流,建了个专门的开源共建兴趣组微信群,可加微信 <code>fxxkol</code> 申请进群。</p>
21+
</StarlightLayout>

.knosys/sites/default/src/shared/constants/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const I18N_CONFIG: LocaleValue<LocaleConfig> = {
1414
},
1515
navs: {
1616
guides: 'Guides',
17+
community: 'Community',
1718
},
1819
},
1920
zh: {
@@ -23,6 +24,7 @@ const I18N_CONFIG: LocaleValue<LocaleConfig> = {
2324
},
2425
navs: {
2526
guides: '指南',
27+
community: '社区',
2628
},
2729
},
2830
};

.knosys/sites/default/src/shared/types/locale.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type SiteConfig = {
99

1010
type NavConfig = {
1111
guides: string;
12+
community: string;
1213
};
1314

1415
type LocaleConfig = {

0 commit comments

Comments
 (0)