hexo运行和发布

本地运行hexo

  • 初始化hexo
$ hexo init
  • 1

 
* 安装生成器

$ cnpm install
  • 1

 
* 运行hexo,以后要在本地运行博客只要输入该命令即可

$ hexo s -g
  • 1

 
打开浏览器,输入localhost:4000,就可以在本地看到你的个人博客了 

* 停止运行 
按住Ctrl+C键即可停止

管理博客

  • 配置信息 
    使用Sublime_Text编辑器(绿色软件无需安装,解压即可使用)打开blog/_config.yml文件,进行配置 
#博客名称
title: 我的博客
#副标题
subtitle: 一天进步一点
#简介
description: 记录生活点滴
#博客作者
author: John Doe
#博客语言
language: zh-CN
#时区
timezone:

#博客地址,与申请的GitHub一致
url: http://elfwalk.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

#博客主题
theme: landscape

#发布设置
deploy: 
  type: git
  #elfwalk改为你的github用户名
  repository: https://github.com/elfwalk/elfwalk.github.io.git
  branch: master
  • 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
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 写一篇文章 
    输入创建文章命令,生成一个md文件(/blog/source/_posts/)
$ hexo new "hello"
  • 1

 
用编辑器打开hello.md文件,编写完后保存

title: hello
date: 2015-07-01 22:37:23
categories:
  - 日志
  - 二级目录
tags:
  - hello
---

摘要:
<!--more-->
正文:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

发布博客

  • 设置git身份信息
$ git config --global user.name "你的用户名"
$ git config --global user.email "你的邮箱"
  • 1
  • 2

 
* 安装hexo git插件

$ cnpm install hexo-deployer-git --save
  • 1

 
* 发布更新博客

$ hexo d -g
  • 1

发布时需要输入github的帐号和密码,输入密码时是看不到自己输入的内容的 
 
发布成功后,访问yourname.github.io看下成果

原文地址:http://hifor.net/2015/07/01/零基础免费搭建个人博客-hexo-github

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jzooo/article/details/46781805

猜你喜欢

转载自jsczxy2.iteye.com/blog/2420192