Skip to content

Commit 6ef7a75

Browse files
committed
feat: vitepress page done
1 parent 58cafbc commit 6ef7a75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2069
-45
lines changed

.github/workflows/deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
2+
#
3+
name: Deploy VitePress site to Pages
4+
5+
on:
6+
# 在针对 `main` 分支的推送上运行。如果你
7+
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
8+
push:
9+
branches: [main]
10+
11+
# 允许你从 Actions 选项卡手动运行此工作流程
12+
workflow_dispatch:
13+
14+
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
21+
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
22+
concurrency:
23+
group: pages
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# 构建工作
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
35+
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消注释
36+
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
37+
- name: Setup Node
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
41+
cache: npm # 或 pnpm / yarn
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
- name: Install dependencies
45+
run: npm ci # 或 pnpm install / yarn install / bun install
46+
- name: Build with VitePress
47+
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: docs/.vitepress/dist
52+
53+
# 部署工作
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
needs: build
59+
runs-on: ubuntu-latest
60+
name: Deploy
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,5 @@ cython_debug/
161161

162162
.idea
163163

164+
node_modules
165+
docs/.vitepress/cache

docs/.vitepress/config.mjs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import {defineConfig} from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
title: "程序员阿江-Relakkes的爬虫教程",
6+
description: "程序员阿江-Relakkes的爬虫教程",
7+
lastUpdated: true,
8+
themeConfig: {
9+
search: {
10+
provider: 'local'
11+
},
12+
// https://vitepress.dev/reference/default-theme-config
13+
nav: [
14+
{text: '首页', link: '/'},
15+
{text: 'B站主页', link: 'https://space.bilibili.com/434377496'},
16+
{text: '联系作者', link: 'https://github.com/NanmiCoder'},
17+
],
18+
19+
sidebar: [
20+
{
21+
text: 'Python爬虫入门',
22+
collapsed: false,
23+
items: [
24+
{text: '01_为什么要写这个爬虫教程', link: '/爬虫入门/01_为什么要写这个爬虫教程'},
25+
{text: '02_个人学会爬虫能赚钱吗', link: '/爬虫入门/02_个人学会爬虫能赚钱吗'},
26+
{text: '03_网络爬虫到底是什么', link: '/爬虫入门/03_网络爬虫到底是什么'},
27+
{text: '04_爬虫的基本工作原理', link: '/爬虫入门/04_爬虫的基本工作原理'},
28+
{text: '05_常用的抓包工具有那些', link: '/爬虫入门/05_常用的抓包工具有那些'},
29+
{
30+
text: '06_Python写爬虫的优势',
31+
link: '/爬虫入门/06_为什么说用Python写爬虫有天生优势'
32+
},
33+
{text: '07_Python常见的网络请求库', link: '/爬虫入门/07_Python常见的网络请求库'},
34+
{text: '08_入门实战1_静态网页数据提取', link: '/爬虫入门/08_爬虫入门实战1_静态网页数据提取'},
35+
{text: '09_入门实战2_动态数据提取', link: '/爬虫入门/09_爬虫入门实战2_动态数据提取'},
36+
{text: '10_入门实战3_数据存储实现', link: '/爬虫入门/10_爬虫入门实战3_数据存储实现'},
37+
{text: '11_入门实战4_高效率的爬虫实现', link: '/爬虫入门/11_爬虫入门实战4_高效率的爬虫实现'},
38+
{
39+
text: '12_入门实战5_编写易于维护的代码',
40+
link: '/爬虫入门/12_爬虫入门实战5_编写易于维护的爬虫代码'
41+
}
42+
]
43+
}
44+
],
45+
46+
socialLinks: [
47+
{icon: 'github', link: 'https://github.com/NanmiCoder/CrawlerTutorial'}
48+
]
49+
},
50+
51+
})

docs/.vitepress/theme/custom.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* .vitepress/theme/custom.css */
2+
/**
3+
* Component: Sidebar
4+
* -------------------------------------------------------------------------- */
5+
6+
:root {
7+
--vp-sidebar-width: 285px;
8+
--vp-sidebar-bg-color: var(--vp-c-bg-alt);
9+
}

docs/.vitepress/theme/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// .vitepress/theme/index.js
2+
import DefaultTheme from 'vitepress/theme'
3+
import './custom.css'
4+
5+
export default DefaultTheme

README.md renamed to docs/index.md

Lines changed: 10 additions & 11 deletions

0 commit comments

Comments
 (0)