An open API service indexing awesome lists of open source software.

https://github.com/zhou-tao/vitepress-theme-me

:books: vitepress theme for personal website.
https://github.com/zhou-tao/vitepress-theme-me

vitepress vitepress-theme website

Last synced: 14 days ago
JSON representation

:books: vitepress theme for personal website.

Awesome Lists containing this project

README

        

# vitepress-theme-me


npm package
build status

A lightweight VitePress theme plugin to help you quickly build personal sites.

- :sparkles: Simple and beautiful theme, inspired by [antfu.me](https://antfu.me).
- :rocket: Fastest localized full-text search powered by [flexsearch](https://github.com/nextapps-de/flexsearch).
- :speech_balloon: Configurable site comment system based on [waline](https://waline.js.org/).

Visit [my site](https://toryz-me.netlify.app/) to get a quick look at **vitepress-theme-me** features.

Documentation is coming soon...

### Install

Please prepare the [VitePress](https://vitepress.dev/zh/guide/getting-started) app first. then install it:

```bash
pnpm add vitepress-theme-me flexsearch vitepress-plugin-search unocss -D
```

### Usage

1. Extends base configs of `vitepress-theme-me`.

```js
// .vitepress/config.js
import { defineConfigWithTheme } from 'vitepress'
import baseConfig from 'vitepress-theme-me/config'

export default defineConfigWithTheme({
extends: baseConfig,
title: 'vitepress.me',
description: 'vitepress theme for personal website.',
head: [
[
'link',
{ rel: 'icon', href: '/logo.svg' } // add logo.svg to under the public dir
]
],
themeConfig: {
logo: '/logo.svg',
nav: [
{ text: '文章', link: '/posts' }, // add posts.md from example and mkdir posts
{ text: '项目', link: '/projects' }, // add projects.md
{ text: '友链', link: '/friend-links' }, // add friend-links.md
{
text: '为爱发电',
link: 'https://afdian.net/a/toryz?tab=home',
icon: {
svg: ''
}
},
{
text: 'Github',
link: 'https://github.com/zhou-tao',
icon: {
name: 'github'
}
}
]
},
waline: {
// !Notice: need replace to your site and see more details (https://waline.js.org/guide/get-started/)
serverURL: 'https://replace.your.site/example',
requiredMeta: ['nick', 'mail'],
wordLimit: 200,
pageSize: 5,
dark: 'html.dark'
}
})
```

   For the files that need to be added, see the [example](https://github.com/zhou-tao/vitepress-theme-me/tree/main/example).

2. Replaces the vitepress default theme.

```js
// .vitepress/theme/index.js
import { Layout, useProgressBar } from 'vitepress-theme-me'
import 'uno.css'
import 'vitepress-theme-me/style.css'

export default {
Layout,
async enhanceApp({ app, router }) {
await useProgressBar(import.meta.env.SSR, router)
}
}
```

3. Config the full-context search plugin.

> [!NOTE]
> you need to add `vite.config.js` to your root directory.

```js
// vite.config.js
import { SearchPlugin } from 'vitepress-plugin-search'
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [
SearchPlugin({
placeholder: 'Search Posts',
buttonLabel: 'Search',
previewLength: 10,
tokenize: 'full'
})
],
optimizeDeps: { exclude: ['fsevents'] },
server: {
fs: {
// Allow serving files from one level up to the project root
allow: ['../..']
}
}
})
```

Next, it's time to launch the app and build your site!

And you can also check out the [example app](https://github.com/zhou-tao/vitepress-theme-me/tree/main/example).

### License

[MIT](./LICENSE) LICENSE © 2023-PRESENT [Toryz](https://github.com/zhou-tao)