hexo搭建博客

---

整体过程很简单,需要修改的地方(样式)全看个人,我只把必须修改的地方列在下面

---

使用了hexo和butterfly主题


 

## 下载hexo(根目录cmd)

``` js

npm install hexo -g

查看版本

hexo version

```

## 初始化博客项目(搭建项目的位置cmd)

会创建一个myblog的文件夹

``` js

hexo init myblog

```

## 安装相关依赖(项目内cmd)

``` js

npm insatll

```

## 启动服务

``` js

hexo serve

```


 

## 连接github仓库(根目录)

``` js

git config --global user.name "xxxxxx"

git config --global user.email "xxxxxxx"

```

### 注意:创建项目时一定要写成https://username.github.io这种,比如我这个填的是heyfriendis.github.io

## 配置文件(项目内)

``` js

__config.yml 目录下修改deploy

deploy:

  type: 'git' //提交方式

  repo: 'https://github.com/heyfriendis/heyfriendis.github.io' //仓库http地址

  branch: main //提交分支

# Site

  title: Welcome my friends

  subtitle: ''

  description: ''

  keywords:

  author: heyfriendis

  language: zh-CN

  timezone: ''


 

url: https://heyfriendis.github.io //url内的配置

```

## 安装提交插件

``` js

npm install hexo-deployer-git --save

```

## 提交

#### 清理缓存

``` js

hexo clean

```

#### 生成文件

``` js

hexo g

```

#### 提交

``` js

hexo d

```

## 下载butterfly主题

``` js

npm i hexo-theme-butterfly

```

在_config下修改theme: theme: butterfly

## 下载运行需要的依赖

``` js

npm install hexo-renderer-pug hexo-renderer-stylus --save

```

## 404访问页面

```

打开node_modules下的hexo-butterfly配置文件

把config.yml复制下来

到主文件夹创建_config.butterfly.yml中黏贴

搜索404把配置改为true

```

 

如果想要更加详细的修改,请访问官方文档:https://butterfly.js.org/

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值