0%

利用Github Pages快速搭建Hexo个人博客

利用github可以方便快速地搭建自己的个人博客,hexo是一个静态博客工具,帮助你自定义您的网站

安装hexo

安装Node.js

下载地址:https://nodejs.org/en/download/

安装:https://github.com/nodejs/help/wiki/Installation

安装Hexo

npm install -g hexo-cli

如果有权限问题:sudo chown -R whoami /usr/local/lib/nodejs

初始化文件夹

$ hexo init <folder>
$ cd <folder>
$ npm install

配置基本信息

打开blog/_config.yml,该文件配置网站大部分信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 配置网站名称,作者姓名,语言等

# Site
title: let's to go
subtitle: ''
description: ''
keywords:
author: ZhangHao
language: zh-Hans
timezone: ''

# 配置主题

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next

# 配置github pages地址

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: git@github.com:httogo/httogo.github.io.git
branch: master

主题安装

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

配置:

./themes/next/_config.yml

# Schemes
#scheme: Muse
scheme: Mist
#scheme: Pisces
#scheme: Gemini

安装插件

npm install --save hexo-tag-aplayer
npm install hexo-deployer-git --save

添加ssh key到github

git config --global user.name "name"
git config --global user.email "123456789@qq.com"
ssh-keygen -t rsa -C "123456789@qq.com"

~/.ssh/id_rsa.pub内容添加到github的sshkey

测试github连接:

ssh -T git@github.com

写作发布

hexo clean
hexo generate
hexo deploy

主页不显示博客全文

可以在需要截断的地方插入<!--more-->
参考链接

参考链接

https://hexo.io/zh-cn/docs/