Hexo-hexo+github创建个人博客
2018-06-24 本文已影响0人
playman
本文通过Hexo+github以及腾讯云搭建一个个人博客
1、GitHub账户
2、腾讯云账号以及域名
3、Node.js环境
4、Windows 下 Git环境
本文操作环境为 Win7 64bit
GitHub账号
1、官网注册——https://github.com/

2、创建仓库


选择一个主题


之后保存【save】就可以了
然后访问 你的github用户名.github.io 就可以看到
腾讯云账号以及域名
1、注册腾讯云——https://dnspod.qcloud.com/?from=qcloud/
2、购买域名

按照流程一步一步走下来即可
安装Node.js环境
1、官网下载——https://nodejs.org/en/

2、安装
双击安装,一路【next】

安装Git环境
1、官网下载Git——https://git-scm.com/

2、安装
一样,一路【next】

恭喜,没有出错就准备工作做好了~~~
正文
安装Hexo
1、创建一个文件夹(英文命名)

2、启动 GitBsah


3、安装Hexo
- 切换源(换成淘宝的源)
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
- 执行安装
$ cnpm install -g hexo-cli
$ cnpm install hexo --save
验证一下
$ hexo -v

- 初始化
$ hexo init
- 安装生成器,保存到本地文件夹
$ cnpm install
- 运行
$ hexo s -g
打开浏览器 http://localhost:4000/

【Ctrl】+【c】 停止运行
- 配置博客
打开【_config.yml】 文件
#博客名称
title: 我的博客
#副标题
subtitle: 一天进步一点
#简介
description: 记录生活点滴
#博客作者
author: ben boss
#博客语言
language: zh-CN
#时区
timezone:
#博客地址,与申请的GitHub一致
url: http://username.github.io
root: /
#博客链接格式
permalink: :year/:month/:day/:title/
permalink_defaults:
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: true
line_number: true
auto_detect: true
tab_replace:
default_category: uncategorized
category_map:
tag_map:
#日期格式
date_format: YYYY-MM-DD
time_format: HH:mm:ss
#分页,每页文章数量
per_page: 10
pagination_dir: page
#博客主题,选择其它主题,在这里是要将themes中的文件夹名替换这里的
theme: landscape
#发布设置
deploy:
type: git
#elfwalk改为你的github用户名
repository: https://github.com/username/username.github.io.git
到这里,本地搭建完成
安装主题
主题的介绍页面