Since maintaining two repos is a bit of a hassle, I decided to merge this repo into my blog repo. This repo will be archived and no longer maintained.
The new repo is a monorepo, and the theme is located at packages/theme.
The package name remains the same, so you can still install it with pnpm i -D vitepress-theme-linear.
A dream theme for vitepress blogs.
Follow guide on the official site to build up your site with default theme first.
- Install the NPM package.
pnpm i -D vitepress-theme-linear- Modify
scriptsconfig in yourpackage.json.
{
"scripts": {
"theme": "cd docs/.vitepress/ && rm -rf theme && ln -s ../../node_modules/vitepress-theme-linear/src theme && cd ../../",
"dev": "npm run theme && vitepress dev docs",
"build": "npm run theme && vitepress build docs"
}
}Refer to official guide to create the config.ts file.
links:- type: Array;
- item:
- name: String - name of the link item;
- link: String - url of the link item;
- icon: String - path to the icon (public assets should be placed at
publicfolder indocsfolder);
posts: UsegetPostsfunction to generate.
Don't worry if module
./theme/configis not found.
import { defineConfigWithTheme } from 'vitepress'
import type { ThemeLinearConfig } from './theme/config'
import { getPosts } from './theme/config'
const locale = 'en-US'
const timezone = 'Asia/Shanghai'
async function load() {
return defineConfigWithTheme<ThemeLinearConfig>({
themeConfig: {
posts: await getPosts(locale, timezone),
links: [
{ name: 'GitHub', link: 'https://github.com/syy11cn', icon: '/assets/images/github.svg' },
]
}
})
}
export default load()Create posts folder in docs and add markdown files to it.
For Individual pages, create markdown files directly in docs folder.
For static assets, take github.svg as example, place it in docs/public/assets/images/ folder, and then config the icon property in docs/.vitepress/config.ts to '/assets/images/github.svg'.
npm run devDesign inspired by Evan You's Blog and Anthony Fu's Blog.
MIT © 2022 - PRESENT Yiyang Sun