Initial rearrangment of vuetom site source

This commit is contained in:
2024-10-09 08:23:08 +00:00
parent dbd456a517
commit e9d08bd263
233 changed files with 22841 additions and 1 deletions

View 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, '..')

View 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)