Skip to content

Commit b082ee7

Browse files
committed
feat(blog): add blog for en and ja
1 parent ae7b3ce commit b082ee7

File tree

6 files changed

+182
-0
lines changed

6 files changed

+182
-0
lines changed

src/en/blog/[id].md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
docInfo: false
3+
layout: doc
4+
outline: false
5+
aside: false
6+
docHeader: false
7+
---
8+
9+
<ForumBlogPostHeader
10+
:title="params.title"
11+
:date="params.updatedAt"
12+
:author="params.author"
13+
:description="params.description"
14+
/>
15+
16+
<!-- @content -->
17+
18+
<ForumTopicFooter prev-page-link="./" :text="message.forum.topic.backToTeamBlog" />
19+
20+
<div class="my-2 vp-divider" />
21+
22+
<ForumCommentArea
23+
class="mt-8"
24+
repo="Blog"
25+
v-if="params.commentCount !== -1"
26+
:topic-id="params.id"
27+
:topic-author-id="params.author.id"
28+
/>
29+
30+
<script setup lang="ts">
31+
import { defineClientComponent } from 'vitepress'
32+
import ForumTopicFooter from '~/components/forum/topic/ForumTopicFooter.vue'
33+
import ForumBlogPostHeader from '~/components/forum/blog/ForumBlogPostHeader.vue'
34+
35+
const ForumCommentArea = defineClientComponent(() => {
36+
return import('~/components/forum/ForumCommentArea.vue')
37+
})
38+
39+
import { useLocalized } from '@/hooks/useLocalized'
40+
41+
const { message } = useLocalized()
42+
43+
import { useData } from 'vitepress'
44+
45+
const { params } = useData()
46+
47+
if(!import.meta.env.SSR) {
48+
document.title = document.title.replace('VitePress', params.value.title)
49+
}
50+
</script>

src/en/blog/[id].paths.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Blog from '../../_data/posts.json'
2+
3+
import type ForumAPI from '../../../.vitepress/theme/apis/forum/api'
4+
5+
export default {
6+
async paths() {
7+
return Blog.map((entry) => {
8+
return {
9+
params: {
10+
id: entry.id,
11+
state: entry.state as ForumAPI.TopicState,
12+
title: entry.title,
13+
tags: entry.tags,
14+
createdAt: entry.createdAt,
15+
updatedAt: entry.updatedAt,
16+
author: entry.user,
17+
link: entry.link,
18+
commentCount: entry.tags
19+
.map((val) => String(val))
20+
.includes('NO-COMMENT')
21+
? -1
22+
: entry.commentCount,
23+
} satisfies ForumAPI.PostParams,
24+
content: entry.contentRaw,
25+
}
26+
})
27+
},
28+
}

src/en/blog/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: 团队博客
3+
subtext: 了解更多关于地图相关更新资讯和教程
4+
layout: Headline
5+
aside: false
6+
wip: true
7+
---
8+
9+
<script setup lang="ts">
10+
import ForumBlogPage from '~/components/forum/blog/ForumBlogPage.vue'
11+
</script>
12+
13+
<ForumBlogPage />

src/ja/blog/[id].md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
docInfo: false
3+
layout: doc
4+
outline: false
5+
aside: false
6+
docHeader: false
7+
---
8+
9+
<ForumBlogPostHeader
10+
:title="params.title"
11+
:date="params.updatedAt"
12+
:author="params.author"
13+
:description="params.description"
14+
/>
15+
16+
<!-- @content -->
17+
18+
<ForumTopicFooter prev-page-link="./" :text="message.forum.topic.backToTeamBlog" />
19+
20+
<div class="my-2 vp-divider" />
21+
22+
<ForumCommentArea
23+
class="mt-8"
24+
repo="Blog"
25+
v-if="params.commentCount !== -1"
26+
:topic-id="params.id"
27+
:topic-author-id="params.author.id"
28+
/>
29+
30+
<script setup lang="ts">
31+
import { defineClientComponent } from 'vitepress'
32+
import ForumTopicFooter from '~/components/forum/topic/ForumTopicFooter.vue'
33+
import ForumBlogPostHeader from '~/components/forum/blog/ForumBlogPostHeader.vue'
34+
35+
const ForumCommentArea = defineClientComponent(() => {
36+
return import('~/components/forum/ForumCommentArea.vue')
37+
})
38+
39+
import { useLocalized } from '@/hooks/useLocalized'
40+
41+
const { message } = useLocalized()
42+
43+
import { useData } from 'vitepress'
44+
45+
const { params } = useData()
46+
47+
if(!import.meta.env.SSR) {
48+
document.title = document.title.replace('VitePress', params.value.title)
49+
}
50+
</script>

src/ja/blog/[id].paths.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Blog from '../../_data/posts.json'
2+
3+
import type ForumAPI from '../../../.vitepress/theme/apis/forum/api'
4+
5+
export default {
6+
async paths() {
7+
return Blog.map((entry) => {
8+
return {
9+
params: {
10+
id: entry.id,
11+
state: entry.state as ForumAPI.TopicState,
12+
title: entry.title,
13+
tags: entry.tags,
14+
createdAt: entry.createdAt,
15+
updatedAt: entry.updatedAt,
16+
author: entry.user,
17+
link: entry.link,
18+
commentCount: entry.tags
19+
.map((val) => String(val))
20+
.includes('NO-COMMENT')
21+
? -1
22+
: entry.commentCount,
23+
} satisfies ForumAPI.PostParams,
24+
content: entry.contentRaw,
25+
}
26+
})
27+
},
28+
}

src/ja/blog/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: 团队博客
3+
subtext: 了解更多关于地图相关更新资讯和教程
4+
layout: Headline
5+
aside: false
6+
wip: true
7+
---
8+
9+
<script setup lang="ts">
10+
import ForumBlogPage from '~/components/forum/blog/ForumBlogPage.vue'
11+
</script>
12+
13+
<ForumBlogPage />

0 commit comments

Comments
 (0)