Github Pages+Hexo搭建免费个人博客

安装Git,Node.js

https://git-scm.com/

https://nodejs.org/zh-cn/

运行Git Bash

使用git config --global设置用户名和邮件

git config --global user.name "****"
git config --global user.email "****"

以管理员方式打开cmd ( runas /user:administrator "cmd/k") 安装cnpm ( 使用淘宝镜像源 )

查看版本

git --version

node -v

npm -v

npm install -g cnpm --reistry=https://registry.npm.taobo.org

cnpm -v

全局安装 hexo-cli

cnpm install -g hexo-cli

hexo -v            查看  hexo-cli项 与 node项

新建blog文件夹

cd至blog文件夹的绝对路径

hexo init      初始化博客

hexo server    启动博客

本地预览 http://localhost:4000

免费个人博客搭建成功

部署至远端有多种选择,我来示范部署至 Github

登录Github官网

新建一个仓库  New repository

Repository name   用户名.github.io

Create repository

 blog目录下安装Git部署插件

cnpm install hexo-deployer-git --save

设置_config.yml文件

notepad _config.yml        

type: git    

repo: 仓库地址    

branch: master

部署至远端            hexo d

输入Github账号,密码

等待完成即可

更换博客主题

例:在blog目录中下载主题(选择一个即可)

git clone https://github.com/iissnan/hexo-theme-next themes/next

*git clone https://github.com/litten/hexo-yilia.git themes/yilia
*git clone https://github.com/nexmoe/hexo-theme-nexmoe themes/nexmoe
*git clone https://github.com/Shen-Yu/hexo-theme-ayer themes/ayer
*git clone https://github.com/jerryc127/hexo-theme-butterfly themes/butterfly
*git clone https://github.com/tufu9441/maupassant-hexo themes/cheng

修改_config.yml文件

更改主题名称
theme: landscape>>>next

hexo clean    

hexo generate

hexo deploy

完成

在这里插入图片描述

其他美化步骤请自行查询相关教程

一些Hexo命令

编写新的博文

$ hexo new "文章名称"

More info: Writing

运行服务

$ hexo server

More info: Server

生成静态文件

$ hexo generate

More info: Generating

部署到远程站点

$ hexo deploy

More info: Deployment

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值