使用hexo和github pages搭建个人博客

本文详细介绍如何通过GitHub Pages和Hexo快速搭建个人博客站点的过程,包括注册GitHub账号、创建仓库、安装必要的软件工具如Git、Node.js及Hexo,并进行基本配置以实现博客内容的编写与发布。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 创建Github 域名和空间
1.1注册

注册一个Github账号

1.2 创建仓库

记住Respository name 中的username.github.io 的username 一定与前面的Owner 一致。

2. 安装
  1. 安装Git

  1. 安装Nodej

  1. 安装Hexo(时间可能有点长,不要急)
    以上所有都安装完成之后再安装Hexo
    $ sudo npm install hexo-cli -g
3. 编写,发布

  创建博客
  $ hexo init username.github.io

  更改配置

  主题安装

  为了使博客不太难看,我们需要安装一个主题,切换至刚刚生成的Hexo 目录,安装主题

  $ cd username.github.io

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

  基础配置:打开文件位置username.github.io/_config.yml修改几个键值对, 注意配置的键值之间一定要有空格。更多设置...

  title: 沐雪的小小世界    //你博客的名字

  author: 沐雪  //你的名字

  language: zh-Hans //语言 中文

  theme: next //刚刚安装的主题名称

  deploy:

  type: git //使用Git 发布

  repo: https://github.com/username/username.github.io.git

  主题配置:

  主题配置文件在username.github.io/themes/next/_config.yml中修改,这里略过。

  写文章

  在username.github.io/source/_posts下创建一个名为FirstBlog.md的文件,随便写点,比如“Hello World”。

  测试

  $ hexo s

  测试服务启动,在浏览器中输入https://localhost:4000 就可以访问了。

  安装hexo-deployer-git自动部署发布工具

  $ npm install hexo-deployer-git --save

  发布

  $ hexo clean 

  $hexo g

  $hexo d

 

其他的就看官方文档吧

 

转载于:https://www.cnblogs.com/whhjdi/p/8681592.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值