hexo 博客部署至 CloudFlare Pages
使用 Hexo 框架的话,那么我们可以使用静态页面托管。但是 GitHub 仓库的 GitHub Pages 要求必须把项目库公开,我不想把自己的博客内容在GitHub仓库里公开,所以将自己的 Hexo 博客部署在 CloudFlare Pages。
准备材料
GitHub / GitLab 账户
CloudFlare 账户
部署步骤
在 GitHub / GitLab 创建一个项目
在本地使用 Git 克隆仓库,将 Hexo 生成的博客文件复制过来
使用本地的 Git 命令,上传仓库内容
git add .git commit -m "更新注释"git push
*如为初次使用 Git,请配置用户名和邮箱
git config --global user.name Git用户名git config --global user.email Git注册邮箱
进入 CloudFlare 账户首页,转到“Pages”
点击“创建项目”→“连接到 Git”
选择自己部署 Hexo 的仓库
调整部署设置
构建完成后,你就可以使用 cf 生成的 ...
hexo搭建
hexo 搭建方法本文以winddows系统安装hexo博客框架为例
一、hexo本地安装
二、提交到github仓库
三、最轻便,最美主题安装,以及优质主题推荐
第一部分1、安装环境node.js
安装时注意添加路径
https://nodejs.org/en/
2、安装git bash
https://git-scm.com/download/win
3、在 git bash 中输入以下命令开始全局安装 Hexo
npm install -g hexo-cli
在 git bash 中输入
hexo init 自定义博客名(会生成自定义文件夹)
在 git bash 中输入hexo g ,编译静态文件到public文件夹,这是根目录会自动生成public文件夹
hexo g
在 git bash 中输入hexo s,启动本地预览,关闭gitbash后,就无法预览
hexo s
输入 http://localhost:4000 ,能正常访问,则启动成功
第二部分3、将hexo代码提交到github仓库,
注册github.com账号
新建一个github仓库
3.1、生成SSH密钥 ...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post$ hexo new "My New Post"
More info: Writing
Run server$ hexo server
More info: Server
Generate static files$ hexo generate
More info: Generating
Deploy to remote sites$ hexo deploy
More info: Deployment
