diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 4524c0326..8c81cf5bd 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -17,24 +17,28 @@ jobs: # 任务1: 部署 GitHub Pages deploy-github-pages: runs-on: ubuntu-latest - steps: # 1、检出源码 - name: Checkout uses: actions/checkout@v3 - - # 2、安装模块并打包 - - name: Install and Build - run: | - yarn install - yarn build - - # 3、部署 GitHub Pages + # 2、安装 Node 环境 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: yarn + # 3、安装依赖 + - name: Install dependencies + run: yarn install --frozen-lockfile + # 4、打包 + - name: Build + run: yarn build + # 5、部署 GitHub Pages - name: Deploy GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 with: BRANCH: pages - FOLDER: repos/.vitepress/dist + FOLDER: docs/.vitepress/dist # 任务2: 部署 Gitee Pages deploy-gitee-pages: diff --git a/.gitignore b/.gitignore index eacd117fd..ab0e1f17a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ coverage/ .vscode # Temp files -yarn.lock package-lock.json .vite_opt_cache diff --git a/README.md b/README.md index 1f25948ef..54e676100 100644 --- a/README.md +++ b/README.md @@ -41,35 +41,35 @@ yarn build - [x] 主页美化:参照 vite 文档主页进行美化 - [x] 自定义页脚:支持ICP备案号、公安备案号、版权信息配置(符合大陆网站审核要求) - [x] 文章元数据信息显示:文章标题下显示作者、发布时间、所属分类、标签列表等信息 -- [x] 《我的标签》:模仿语雀标签页风格,https://www.yuque.com/r/语雀用户名/tags?tag=,另有标签云展示 +- [x] 《我的标签》:模仿语雀标签页风格,另有标签云展示。语雀标签页地址:https://www.yuque.com/r/语雀用户名/tags?tag= - [x] 《我的归档》:自定义时间轴,展示历史文章数据。年份前可展示生肖,可按分类、标签筛选 - [x] 更多细节优化:敬请发现 -- [ ] 文章评论:Gitalk +- [x] 文章评论:目前仅支持Gitalk ## 部分页面截图 ### 主页美化 -![主页](./repos/public/screenshot/主页.png) +![主页](./docs/public/screenshot/主页.png) ### 文章元数据信息 -![文章元数据信息](./repos/public/screenshot/文章元数据信息.png) +![文章元数据信息](./docs/public/screenshot/文章元数据信息.png) ### 我的标签 -![我的标签](./repos/public/screenshot/我的标签1.png) -![我的标签](./repos/public/screenshot/我的标签2.png) +![我的标签](./docs/public/screenshot/我的标签1.png) +![我的标签](./docs/public/screenshot/我的标签2.png) ### 我的归档 -![我的归档](./repos/public/screenshot/我的归档1.png) -![我的归档](./repos/public/screenshot/我的归档2.png) +![我的归档](./docs/public/screenshot/我的归档1.png) +![我的归档](./docs/public/screenshot/我的归档2.png) -### 文章评论(未完待续) +### 文章评论 -![文章评论](./repos/public/screenshot/文章评论1.png) -![文章评论](./repos/public/screenshot/文章评论2.png) +![文章评论](./docs/public/screenshot/文章评论1.png) +![文章评论](./docs/public/screenshot/文章评论2.png) ## 致谢 @@ -80,6 +80,7 @@ yarn build - [brc-dd/vitepress-with-arco](https://github.com/brc-dd/vitepress-with-arco) - [clark-cui/vitepress-blog-zaun](https://github.com/clark-cui/vitepress-blog-zaun) (参考文章标签的数据处理方案) - [dingqianwen/my-blog](https://github.com/dingqianwen/my-blog) (参考 Gitalk 配置暗黑主题) +- [Dedicatus546/Dedicatus546.github.io](https://github.com/Dedicatus546/Dedicatus546.github.io) (参考 Gitalk 跨域调用 API 失效的解决方案) - [xiaoxian521/pure-admin-utils-docs](https://github.com/xiaoxian521/pure-admin-utils-docs) (参考词云组件的使用) - [arco-design/arco-design-vue](https://github.com/arco-design/arco-design-vue) (使用部分组件及图标) - [antvis/G2plot](https://github.com/antvis/G2plot) (使用部分图表) diff --git a/collect-article-data.mjs b/collect-article-data.mjs index 0e382eddd..c35c84b25 100644 --- a/collect-article-data.mjs +++ b/collect-article-data.mjs @@ -3,10 +3,10 @@ import matter from 'gray-matter' import fs from 'node:fs/promises' const articleData = await Promise.all( - glob.sync('./repos/**/*.md', { + glob.sync('./docs/**/*.md', { onlyFiles: true, objectMode: true, - ignore: ['./repos/**/index.md', './repos/**/tags.md', './repos/**/archives.md', './repos/**/me.md'], // without ! + ignore: ['./docs/**/index.md', './docs/**/tags.md', './docs/**/archives.md', './docs/**/me.md'], // without ! }).map(async (article) => { const file = matter.read(`${article.path}`) const { data, path } = file diff --git a/repos/.vitepress/config.ts b/docs/.vitepress/config.ts similarity index 100% rename from repos/.vitepress/config.ts rename to docs/.vitepress/config.ts diff --git a/repos/.vitepress/config/constants.ts b/docs/.vitepress/config/constants.ts similarity index 100% rename from repos/.vitepress/config/constants.ts rename to docs/.vitepress/config/constants.ts diff --git a/repos/.vitepress/config/head.ts b/docs/.vitepress/config/head.ts similarity index 100% rename from repos/.vitepress/config/head.ts rename to docs/.vitepress/config/head.ts diff --git a/repos/.vitepress/config/markdown.ts b/docs/.vitepress/config/markdown.ts similarity index 91% rename from repos/.vitepress/config/markdown.ts rename to docs/.vitepress/config/markdown.ts index edeef12c7..6e42ae941 100644 --- a/repos/.vitepress/config/markdown.ts +++ b/docs/.vitepress/config/markdown.ts @@ -5,7 +5,6 @@ export const markdown: MarkdownOptions = { lineNumbers: true, // 启用行号 // 在所有文档的

标签后添加组件 - // 感谢: https://github.com/vuejs/vitepress/issues/1050 config: (md) => { md.renderer.rules.heading_close = (tokens, idx, options, env, slf) => { let htmlResult = slf.renderToken(tokens, idx, options, env, slf) diff --git a/repos/.vitepress/config/nav.ts b/docs/.vitepress/config/nav.ts similarity index 100% rename from repos/.vitepress/config/nav.ts rename to docs/.vitepress/config/nav.ts diff --git a/repos/.vitepress/config/sidebar.ts b/docs/.vitepress/config/sidebar.ts similarity index 93% rename from repos/.vitepress/config/sidebar.ts rename to docs/.vitepress/config/sidebar.ts index 35bda7dc5..1ee603984 100644 --- a/repos/.vitepress/config/sidebar.ts +++ b/docs/.vitepress/config/sidebar.ts @@ -23,25 +23,25 @@ function getItemsByDate (path: string) { let items: DefaultTheme.SidebarItem[] = [] // 1.获取所有年份目录 - sync(`repos/${path}/*`, { + sync(`docs/${path}/*`, { onlyDirectories: true, objectMode: true }).forEach(({ name }) => { let year = name // 2.获取所有月份目录 - sync(`repos/${path}/${year}/*`, { + sync(`docs/${path}/${year}/*`, { onlyDirectories: true, objectMode: true }).forEach(({ name }) => { let month = name // 3.获取所有日期目录 - sync(`repos/${path}/${year}/${month}/*`, { + sync(`docs/${path}/${year}/${month}/*`, { onlyDirectories: true, objectMode: true }).forEach(({ name }) => { let day = name // 4.获取日期目录下的所有文章 - sync(`repos/${path}/${year}/${month}/${day}/*`, { + sync(`docs/${path}/${year}/${month}/${day}/*`, { onlyFiles: true, objectMode: true }).forEach(({ name }) => { @@ -93,13 +93,13 @@ function getItems (path: string) { let items: DefaultTheme.SidebarItem[] = [] // 1.获取所有分组目录 - sync(`repos/${path}/*`, { + sync(`docs/${path}/*`, { onlyDirectories: true, objectMode: true }).forEach(({ name }) => { let groupName = name // 2.获取分组下的所有文章 - sync(`repos/${path}/${groupName}/*`, { + sync(`docs/${path}/${groupName}/*`, { onlyFiles: true, objectMode: true }).forEach(({ name }) => { diff --git a/repos/.vitepress/config/theme.ts b/docs/.vitepress/config/theme.ts similarity index 88% rename from repos/.vitepress/config/theme.ts rename to docs/.vitepress/config/theme.ts index f93ae6432..355687446 100644 --- a/repos/.vitepress/config/theme.ts +++ b/docs/.vitepress/config/theme.ts @@ -48,16 +48,15 @@ export const themeConfig: DefaultTheme.Config = { type: 'gitalk', options: { clientID: '1de126ce1fbdbe049709', - clientSecret: '97e359a006ba7b0d8e9d9bf38b83de59eb69ecba', + clientSecret: '035fe49874a43e5cefc28a99b7e40b1925319c62', repo: 'charles7c.github.io-comments', owner: 'Charles7c', admin: ['Charles7c'], language: 'zh-CN', distractionFreeMode: false, // 默认: https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token - // 感谢: https://prohibitorum.top/2022/07/26/%E8%A7%A3%E5%86%B3-Gitalk-%E6%97%A0%E6%B3%95%E8%8E%B7%E5%8F%96-Github-Token-%E9%97%AE%E9%A2%98/ proxy: 'https://cors-server-ecru.vercel.app/github_access_token' }, - hideComments: true // 全局隐藏评论,默认 false + showComment: true // 是否显示评论 } } \ No newline at end of file diff --git a/repos/.vitepress/theme/MyLayout.vue b/docs/.vitepress/theme/MyLayout.vue similarity index 66% rename from repos/.vitepress/theme/MyLayout.vue rename to docs/.vitepress/theme/MyLayout.vue index 875e75c6b..46271b7db 100644 --- a/repos/.vitepress/theme/MyLayout.vue +++ b/docs/.vitepress/theme/MyLayout.vue @@ -1,7 +1,7 @@