博客搭建
Dandelion 4/25/2022
# 方案参考
# GitHub-Vercel-Vuepress
- 搭建博客
- npm install @vuepress-reco/theme-cli -g
- theme-cli init
- 新建仓库并上传博客至仓库
- GitHub -> New Repository
- git init
- git add .
- git commit -m "first commit blogs"
- git branch -M main
- git remote add origin git@github.com:Dandelion-F/Herb-Hub.git
- git push -u origin main
- 部署博客
- Vercel -> dashboard -> import
- 都选默认,部署完成(so easy!I like it!)
- 参考
# GitHub-Hexo
- 使用 hexo 生成博客
- 安装 node.js
- 安装 hexo:npm install -g hexo-cli
- 测试 hexo 是否成功安装:hexo -v
- 建立一个空目录:
mkdir blog
&cd blog
- 使用 hexo:
- sudo hexo init
- hexo s
- hexo n "博客文章名字"
- hexo clean
- hexo g
- 将博客部署到 GitHub
- GitHub -> New Repository(严格按照:用户名.github.io)
- 安装 hexo git 部署工具:
npm install --save hexo-deployer-git
- 设置
_config.yml
文件:deploy -> type/repo/branch - 部署:
hexo d
- 注意:仓库下一定得有 readme 文件,不然会报 404 错误!!!
- 更换博客主题
- 下载主题:git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
- 配置主题,修改
_config.yml
文件:theme: yilia
hexo clean
&hexo g
&hexo s
- 部署到远端:
hexo d
- 参考