Skip to content

Commit 9a2a235

Browse files
committed
feat: 集成 @nolebase/vitepress-plugin-index
Signed-off-by: Neko Ayaka <neko@ayaka.moe>
1 parent 4f2276a commit 9a2a235

8 files changed

Lines changed: 139 additions & 51 deletions

File tree

.vitepress/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ export default defineConfig({
211211
{ text: '主页', link: '/' },
212212
{ text: '笔记', link: '/笔记/' },
213213
{ text: '编目 Catalog', link: '/编目 Catalog/' },
214-
{ text: '最近更新', link: '/toc' },
215214
],
216215
sidebar: calculateSidebar([
217216
{ folderName: '笔记', separate: true },

.vitepress/theme/components/TocList.vue

Lines changed: 0 additions & 47 deletions
This file was deleted.

.vitepress/theme/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import {
1313
NolebaseHighlightTargetedHeading,
1414
} from '@nolebase/vitepress-plugin-highlight-targeted-heading/client'
1515

16+
import {
17+
NolebaseIndexPlugin,
18+
} from '@nolebase/vitepress-plugin-index/client'
19+
1620
import {
1721
NolebaseInlineLinkPreviewPlugin,
1822
} from '@nolebase/vitepress-plugin-inline-link-preview/client'
@@ -33,10 +37,10 @@ import AppContainer from './components/AppContainer.vue'
3337
import DocFooter from './components/DocFooter.vue'
3438
import HomePage from './components/HomePage.vue'
3539
import Share from './components/Share.vue'
36-
import TocList from './components/TocList.vue'
3740

3841
import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css'
3942
import '@nolebase/vitepress-plugin-highlight-targeted-heading/client/style.css'
43+
import '@nolebase/vitepress-plugin-index/client/style.css'
4044
import '@nolebase/vitepress-plugin-inline-link-preview/client/style.css'
4145
import '@nolebase/vitepress-plugin-git-changelog/client/style.css'
4246
import '@nolebase/vitepress-plugin-page-properties/client/style.css'
@@ -81,7 +85,6 @@ const ExtendedTheme: Theme = {
8185
app.component('HomePage', HomePage)
8286
app.component('DocFooter', DocFooter)
8387
app.component('Share', Share)
84-
app.component('TocList', TocList)
8588
app.component('AppContainer', AppContainer)
8689
app.component('NolebaseUnlazyImg', NolebaseUnlazyImg)
8790

@@ -133,6 +136,8 @@ const ExtendedTheme: Theme = {
133136
],
134137
},
135138
})
139+
140+
app.use(NolebaseIndexPlugin)
136141
},
137142
}
138143

data/toc.data.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createRecentUpdatesLoader } from '@nolebase/vitepress-plugin-index/vitepress'
2+
3+
export default createRecentUpdatesLoader({
4+
dir: '笔记',
5+
})

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"@nolebase/vitepress-plugin-enhanced-readabilities": "^2.7.0",
4343
"@nolebase/vitepress-plugin-git-changelog": "^2.7.0",
4444
"@nolebase/vitepress-plugin-highlight-targeted-heading": "^2.7.0",
45+
"@nolebase/vitepress-plugin-index": "^2.9.0",
4546
"@nolebase/vitepress-plugin-inline-link-preview": "^2.7.0",
4647
"@nolebase/vitepress-plugin-meta": "^2.7.0",
4748
"@nolebase/vitepress-plugin-og-image": "^2.7.0",

pnpm-lock.yaml

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

toc.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
---
2+
nolebase:
3+
gitChangelog: false
4+
pageProperties: false
5+
---
6+
17
# 目录
28

39
排序方式:`最近更新`
410

511
---
612

7-
<TocList />
13+
<script setup>
14+
import { data } from './data/toc.data'
15+
</script>
16+
17+
<NolebaseRecentUpdates :data="data" />

编目 Catalog/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 编目

0 commit comments

Comments
 (0)