【Hexo】01-Hexo和Next初始化

img-07

Hexo、Next初始化

HexoNexT官方文档

hexo -v: 5.4.0

hexo-cli: 4.3.0

next -v: 8.8.0

Hexo安装及初始化

官网(https://hexo.io/zh-cn/)提示

img-01

  1. npm install hexo-cli -g安装hexo

    img-02

  2. hexo init zsq-blog初始化Hexo博客项目

    img-03

    项目路径:

    img-04

  3. cd blognpm install安装依赖的包

    img-05

  4. hexo server启动项目

    img-06

  5. localhost:4000访问主页

    img-07

Hexo指令

指令 说明
hexo server / hexo s 启动服务,端口默认为4000
hexo s -p 80 启动服务,指定端口
hexo generate / hexo g 生成静态文件
hexo deploy / hexo d 部署到远程站点
hexo new page <name> 在resoure目录下生成/name/index.md

Hexo基本配置

/_config.ymlHexo博客的配置文件

可以查看官网:https://hexo.io/zh-cn/docs/configuration

博客基本信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Site
# 网站标题
title: 桦河雾
# 网站副标题
subtitle: '桦河雾'
# 网站描述
description: '好好学习'
# 网站的关键词。支持多个关键词
keywords:
# 您的名字
author: zsq
# 使用语言
language: zh-CN
# 网站时区
timezone: 'Asia/Shanghai'

Next主题安装(8.8.0)

Github地址(https://github.com/next-theme/hexo-theme-next)提示,可以选择最新版本。下面安装的是8.8.0

img-01

  1. 在该网页https://github.com/next-theme/hexo-theme-next/releases/tag/v8.8.0下载NexT主题压缩包

    img-09

  2. 解压到/blog/theme文件夹下,并改文件夹名为next

    img-10

  3. 修改全局配置/blog/_config.yml下的theme

    1
    2
    3
    4
    # Extensions
    ## Plugins: https://hexo.io/plugins/
    ## Themes: https://hexo.io/themes/
    theme: next

    img-11

  4. cp themes/next/_config.yml _config.next.yml

    将配置文件复制到项目根路径

    img-12

  5. hexo s -p 80启动服务并访问

    img-13

-------------本文结束感谢您的阅读-------------