1、安装 homebrew—->nodejs—->hexo
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install node
$ sudo npm install -g hexo
2.创建一个空的文件夹,CD到文件夹下
$ hexo init
3.生成一套静态网页。运行
$ hexo generate
$ hexo server
浏览器打开 http://localhost:4000 验证
4.博文提交,makedown编辑.md,移到~/source/_posts
.md 格式
title: 定义了博文的标题
date: 定义了创作博文的时间
tags: 定义了博文的标签
除了这个三个属性以外我们还可以扩展一些属性:
update: 定义了最后修改的时间
comments:定义能否评论此博文(默认为true)
categories: 定义了博文的种类
重新 hexogenerate, hexo server
5.部署,_config.yml让hexo帮助我们同步github,方便快捷,配置如下所示
_config.yml 中
deploy:
type: git
repo: https://github.com/xxx/xxx.github.io.git
branch: master
xxx为个人github的name
$ hexo -d
6.界面修改 ,修改配置内容
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site ##修改以适应搜索引擎的收录
title: Hexo ##定义网站的标题
subtitle: ##定义网站的副标题
description: ##定义网站的描述
author: jason jwl ##定义网站的负责人
language: ##定义网站的语言,默认zh-Hans
timezone: ##定义网站的时区
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com ##定义网站访问的域名
root: / ##定义所在Web文件夹在哪个目录
permalink: :year/:month/:day/:title/ ##定义时间格式
permalink_defaults:
# Directory
source_dir: source ##定义从哪个文件夹获取博客资料
public_dir: public ##定义生成静态网站到哪个文件夹
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
# Writing
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: false
tab_replace:
# Category & Tag
default_category: uncategorized
category_map:
tag_map:
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
# Pagination
## Set per_page to 0 to disable pagination
per_page: 10 ##定义每一页多少条博客
pagination_dir: page
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landscape ##定义使用的主题
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type:
7.当你增加新的文章或者插件时,可以通过以下三个命令进行同步操作:
hexo clean
hexo generate
hexo deploy