(小白教程)使用hexo搭建自己的个人博客(针对win10系统搭建超详细)

1 篇文章 0 订阅
1 篇文章 0 订阅

搭建此博客需要nodejs的支持(没有下载的小伙伴可以看我上一篇文章)

1.先准备环境(针对win10)

打开命令窗口cmd 先安装hexo框架

  • cnpm install -g hexo-cli

在这里插入图片描述

可以用hexo -v 来验证一下 #查看hexo版本 很明显要nodejs来支持

在这里插入图片描述

md login #创建博客文件login

在这里插入图片描述
在这里插入图片描述

cd login#进入login目录

在这里插入图片描述

hexo init #生成博客 初始化博客

在这里插入图片描述

  • hexo s #启动本地博客服务
  • http://localhost:4000/#本地访问地址 hexo n “我的第一篇文章”
  • #创建新的文章 用cd命令返回login目录
  • hexo clean #清理
  • hexo g #生成
  • 接着hexo s #启动本地博客服务就可以在本地端口访问自己发布的第一篇文章了 (上面我就没截图了,很简单的,大家可以尝试一下)

2.把本地博客发布到github

  • 没有账号可自行注册一个github.com 
    

在这里插入图片描述

#Github创建一个新的仓库 你注册的名字.github.io

在这里插入图片描述

仓库创建完成会来到这里

在这里插入图片描述

接着就用dos命令进入login文件夹

  • 输入cnpm install --save hexo-deployer-git #在login目录下安装git部署插件
  • 接着就用dos命令进入config.yml(记住所有的文件都在login里面)

在这里插入图片描述

  • 配置_config.yml
  • Deployment Docs: https://hexo.io/docs/deployment.html
  • deploy: type: git (固定的)
  • repo:https://github.com/YourGithubName/YourGithubName.github.io.git(这个就是要配置刚才让你复制的地址)
  • branch: master (这个你也跟着来吧)

在这里插入图片描述

接着返回目录,输入以下

  • hexo clean #清理
  • hexo g #生成一下
  • hexo d#部署到Github仓库里(这时候回输入你的账户和密码,如果出现问题不能输入请看最后一步的步骤) https://YourGithubName.github.io/ #访问这个地址可以查看博客
  • 更换主题(前提在目录下) git clone https://github.com/litten/hexo-theme-yilia.git
  • themes/yilia #下载yilia主题到本地
  • (根据刚才上面的方法,用cd命令进入config.yml) 修改login根目录下的 _config.yml 文件 : theme: yilia

在这里插入图片描述
在这里插入图片描述

以上操作填写完成并且保存执行以下命令查看自己的博客(赶快试试吧)

  • hexo c #清理一下
  • hexo g #生成
  • hexo d#部署到远程Github仓库 https://YourGithubName.github.io/ #查看博客
  • 提交远程仓库github时先输入这两句命令,输入之后不用输密码(这样就可以解决每次提交仓库时会让你输入密码)

在这里插入图片描述
在这里插入图片描述

zhangxujun-123.github.io这是我的访问地址,不过我里面什么都没写,等有时间在完善

在这里插入图片描述

最后总结一下笔记

  • 安装Nodejs
  • node -v #查看node版本
  • npm -v #查看npm版本
  • npm install -g cnpm --registry=http://registry.npm.taobao.org #安装淘宝的cnpm 管理器
  • cnpm -v #查看cnpm版本
  • cnpm install -g hexo-cli #安装hexo框架
  • hexo -v #查看hexo版本
  • md login#创建login目录
  • cd login#进入login目录
  • hexo init #生成博客 初始化博客 
    
  • hexo s#启动本地博客服务 
    
  • http://localhost:4000/ #本地访问地址
  • hexo n “我的第一篇文章” #创建新的文章
  • 返回blog目录
  • hexo clean #清理
  • hexo g #生成Github
  • 创建一个新的仓库 YourGithubName.github.io
  • cnpm install --save hexo-deployer-git #在blog目录下安装git部署插件
  • 配置_config.yml
  • Deployment
  • ##Docs: https://hexo.io/docs/deployment.html deploy: type: git repo: https://github.com/YourGithubName/YourGithubName.github.io.git branch:master
  • hexo d #部署到Github仓库里 https://YourGithubName.github.io/ #访问这个地址可以查看博客
  • git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
  • #下载yilia主题到本地
  • #修改hexo根目录下的 _config.yml 文件 : theme: yilia
  • hexo c #清理一下
  • hexo g #生成
  • hexo d #部署到远程Github仓库
  • https://YourGithubName.github.io/ #查看博客

此教程是参考B站一位up主(https://www.bilibili.com/video/BV1Yb411a7ty?t=1621),up主用的mac系统,于是我就在想用windos出了这样一个教程,望大家喜欢,由于平时课也多,没多少时间弄博客,嘿嘿嘿

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值