From 4d56b8bc93ab2c853f160878c25d80aad0c885cf Mon Sep 17 00:00:00 2001 From: bingling-sama Date: Sat, 22 Jun 2024 18:40:31 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E2=9C=A8=20feat(blog):=20create=20blog=20p?= =?UTF-8?q?art?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vitepress/theme/index.ts | 2 ++ .vitepress/theme/layouts/Posts.vue | 15 +++++++++++++++ .vitepress/utils/posts.data.ts | 23 +++++++++++++++++++++++ docs/blog/index.md | 9 +++++++++ docs/blog/post1.md | 15 +++++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 .vitepress/theme/layouts/Posts.vue create mode 100644 .vitepress/utils/posts.data.ts create mode 100644 docs/blog/index.md create mode 100644 docs/blog/post1.md diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index b62b9b84..5d19fa2b 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -6,6 +6,7 @@ import { h } from "vue" // Components import LauncherBadge from "./global-components/LauncherBadge.vue" import ReloadPrompt from "./components/ReloadPrompt.vue" +import Posts from "./layouts/Posts.vue" // Plugins import giscusTalk from "vitepress-plugin-comment-with-giscus" @@ -56,6 +57,7 @@ export default { threshold: 300, }) ctx.app.component("LauncherBadge", LauncherBadge) + ctx.app.component("Posts", Posts) vitepressNprogress(ctx) ctx.app.component("vImageViewer", vImageViewer) ctx.app.use(NolebaseInlineLinkPreviewPlugin) diff --git a/.vitepress/theme/layouts/Posts.vue b/.vitepress/theme/layouts/Posts.vue new file mode 100644 index 00000000..cf6d3481 --- /dev/null +++ b/.vitepress/theme/layouts/Posts.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/.vitepress/utils/posts.data.ts b/.vitepress/utils/posts.data.ts new file mode 100644 index 00000000..9a9b6c7b --- /dev/null +++ b/.vitepress/utils/posts.data.ts @@ -0,0 +1,23 @@ +import { createContentLoader } from "vitepress" + +interface Post { + title: string + url: string + date: string + excerpt: string | undefined +} +declare const data: Post[] +export { data } + +export default createContentLoader("blog/*.md", { + // Options + excerpt: true, + transform(raw): Post[] { + return raw.map(({ url, frontmatter, excerpt }) => ({ + title: frontmatter.title, + url, + date: frontmatter.date, + excerpt + })) + } +}) diff --git a/docs/blog/index.md b/docs/blog/index.md new file mode 100644 index 00000000..11c1b7c3 --- /dev/null +++ b/docs/blog/index.md @@ -0,0 +1,9 @@ +--- +sidebar: false +--- + +# 博客板块 + +本板块包含了 GlobeMC 团队的一些博客文章,有助于提升读者的 Debug 能力,有兴趣的读者可以关注一下。 + + diff --git a/docs/blog/post1.md b/docs/blog/post1.md new file mode 100644 index 00000000..892fbce2 --- /dev/null +++ b/docs/blog/post1.md @@ -0,0 +1,15 @@ +--- +sidebar: false +title: Post1 +date: 2021-01-01T00:00:00Z +--- + +# Post1 + +This is the first post. + +--- + +Some text here. + +This is the end of the first post. From d209408a6198716b0534a105d7d6a0896cc2cd7c Mon Sep 17 00:00:00 2001 From: bingling-sama Date: Sat, 22 Jun 2024 19:02:32 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=93=83=20docs(nav):=20add=20to=20nav?= =?UTF-8?q?=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vitepress/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index a1b41997..c22045d6 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -161,6 +161,7 @@ const themeConfig: DefaultTheme.Config = { nav: [ { text: "主页", link: "/" }, { text: "崩溃分析工具", link: "/analyzer" }, + { text: "博客", link: "/blog/"}, { text: "贡献", activeMatch: "/contribute/*", From e8c713baf254da922657d3c8c33a45304ff72af6 Mon Sep 17 00:00:00 2001 From: bingling-sama Date: Sat, 22 Jun 2024 19:03:32 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=93=83=20docs(nav):=20add=20to=20nav?= =?UTF-8?q?=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vitepress/config.ts | 30 +++++++++++++++++------------- .vitepress/theme/layouts/Posts.vue | 1 - .vitepress/utils/posts.data.ts | 4 ++-- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index c22045d6..5a76668b 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -81,25 +81,25 @@ const pwaConfig: PwaOptions = { { src: "pwa-64x64.png", sizes: "64x64", - type: "image/png" + type: "image/png", }, { src: "pwa-192x192.png", sizes: "192x192", - type: "image/png" + type: "image/png", }, { src: "pwa-512x512.png", sizes: "512x512", - type: "image/png" + type: "image/png", }, { src: "maskable-icon-512x512.png", sizes: "512x512", type: "image/png", - purpose: "maskable" - } - ] + purpose: "maskable", + }, + ], }, workbox: { globPatterns: ["**/*.{css,js,html,svg,webp,ico,txt,woff2}"], @@ -161,7 +161,7 @@ const themeConfig: DefaultTheme.Config = { nav: [ { text: "主页", link: "/" }, { text: "崩溃分析工具", link: "/analyzer" }, - { text: "博客", link: "/blog/"}, + { text: "博客", link: "/blog/" }, { text: "贡献", activeMatch: "/contribute/*", @@ -320,10 +320,11 @@ export default withPwa( lineNumbers: true, config: (md) => { // @ts-expect-error TS2769 - md.use(BiDirectionalLinks({ - dir: "docs", - baseDir: "/", - }), + md.use( + BiDirectionalLinks({ + dir: "docs", + baseDir: "/", + }), ), // @ts-expect-error TS2769 md.use(InlineLinkPreviewElementTransform) @@ -335,8 +336,11 @@ export default withPwa( }, head: [ - ['link', { rel: 'icon', href: '/favicon.ico' }], - ['link', { rel: 'apple-touch-icon', href: '/apple-touch-icon-180x180.png' }], + ["link", { rel: "icon", href: "/favicon.ico" }], + [ + "link", + { rel: "apple-touch-icon", href: "/apple-touch-icon-180x180.png" }, + ], [ "script", { diff --git a/.vitepress/theme/layouts/Posts.vue b/.vitepress/theme/layouts/Posts.vue index cf6d3481..7557c951 100644 --- a/.vitepress/theme/layouts/Posts.vue +++ b/.vitepress/theme/layouts/Posts.vue @@ -1,6 +1,5 @@