Initial rearrangment of vuetom site source
This commit is contained in:
7
packages/blog/.vitepress/conf/path.ts
Normal file
7
packages/blog/.vitepress/conf/path.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import path from 'path'
|
||||
|
||||
export const vpRoot = path.resolve(__dirname, '..')
|
||||
export const blogRoot = path.resolve(vpRoot, '..')
|
||||
export const pageRoot = path.resolve(blogRoot, 'posts')
|
||||
export const pkgsRoot = path.resolve(blogRoot, '..')
|
||||
export const projRoot = path.resolve(pkgsRoot, '..')
|
26
packages/blog/.vitepress/conf/posts.ts
Normal file
26
packages/blog/.vitepress/conf/posts.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import fs from 'fs'
|
||||
import { pageRoot } from './path'
|
||||
|
||||
const readDir = (dir) => {
|
||||
const res = []
|
||||
const files = fs.readdirSync(dir)
|
||||
files.forEach(item => {
|
||||
const filepath = `${dir}/${item}`
|
||||
const stat = fs.statSync(filepath)
|
||||
if (stat.isFile()) {
|
||||
const name = item.replace('.md', '')
|
||||
res.push({
|
||||
text: name,
|
||||
link: `/${name}`
|
||||
})
|
||||
}
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
const getDefaultPage = () => ({
|
||||
text: '',
|
||||
link: ''
|
||||
})
|
||||
|
||||
export default () => readDir(pageRoot)
|
70
packages/blog/.vitepress/config.ts
Normal file
70
packages/blog/.vitepress/config.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { defineConfigWithTheme } from 'vitepress'
|
||||
import { VuetomThemeConfig } from 'vitepress-theme-vuetom'
|
||||
import pages from './conf/posts'
|
||||
|
||||
export default defineConfigWithTheme<VuetomThemeConfig>({
|
||||
lang: 'en-US',
|
||||
title: 'Vuetom Blog',
|
||||
titleTemplate: 'My Blog',
|
||||
description: 'Just a blog',
|
||||
base: '/myblog',
|
||||
ignoreDeadLinks: true,
|
||||
lastUpdated: true,
|
||||
themeConfig: {
|
||||
nav: [
|
||||
{ text: '首页', link: '/' },
|
||||
{ text: '指导', link: '/pages/guide' },
|
||||
{
|
||||
text: '更多',
|
||||
items: [
|
||||
{ text: '分类', link: '/categories/index' },
|
||||
{ text: '标签', link: '/tags/index' }
|
||||
]
|
||||
}
|
||||
],
|
||||
sidebar: [
|
||||
{
|
||||
text: '首页',
|
||||
link: '/'
|
||||
},
|
||||
{
|
||||
text: '指导',
|
||||
link: '/pages/guide'
|
||||
},
|
||||
{
|
||||
text: '更多',
|
||||
items: []
|
||||
}
|
||||
],
|
||||
pages: pages(),
|
||||
outlineTitle: 'In hac pagina',
|
||||
socialLinks: [
|
||||
{
|
||||
icon: 'github',
|
||||
link: 'https://github.com/lauset/vitepress-theme-vuetom'
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
message: 'Released under the MIT License.',
|
||||
copyright: 'Copyright © 2021-present Vuetom'
|
||||
},
|
||||
lastUpdatedText: 'Updated Date',
|
||||
docFooter: {
|
||||
prev: 'Pagina prior',
|
||||
next: 'Proxima pagina'
|
||||
},
|
||||
bgImg: '/imgs/blog-bg.png',
|
||||
avatar: '/imgs/avatar.jpg',
|
||||
author: 'Vuetom',
|
||||
parallaxEnable: true,
|
||||
},
|
||||
markdown: {
|
||||
theme: 'material-palenight',
|
||||
lineNumbers: false
|
||||
},
|
||||
vite: {
|
||||
ssr: {
|
||||
noExternal: ["vitepress-theme-vuetom"]
|
||||
}
|
||||
}
|
||||
})
|
0
packages/blog/.vitepress/theme/custom.scss
Normal file
0
packages/blog/.vitepress/theme/custom.scss
Normal file
18
packages/blog/.vitepress/theme/index.ts
Normal file
18
packages/blog/.vitepress/theme/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// .vitepress/theme/index.js
|
||||
|
||||
// for prod
|
||||
import BlogTheme from 'vitepress-theme-vuetom/blog'
|
||||
|
||||
// old
|
||||
// import { BlogTheme } from 'vitepress-theme-vuetom'
|
||||
|
||||
import './custom.scss'
|
||||
|
||||
export default {
|
||||
...BlogTheme,
|
||||
enhanceApp({ app, router, siteData }) {
|
||||
// globals.forEach(([name, Comp]) => {
|
||||
// app.component(name, Comp)
|
||||
// })
|
||||
}
|
||||
}
|
6
packages/blog/.vitepress/utils/paths.ts
Normal file
6
packages/blog/.vitepress/utils/paths.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import path from 'path'
|
||||
|
||||
export const vpRoot = path.resolve(__dirname, '..')
|
||||
export const docRoot = path.resolve(vpRoot, '..')
|
||||
export const pkgsRoot = path.resolve(docRoot, '..')
|
||||
export const projRoot = path.resolve(pkgsRoot, '..')
|
Reference in New Issue
Block a user