基于hexo创建博客(Github托管)

基于hexo的博客

搭建步骤

  • 1.依赖文件下载 Node.js
  • 2.Hexo的安装
  • 3.部署到Github
  • 4.Hexo创建博客基本操作
  • 5.Hexo主题皮肤更换

依赖文件Node.js

首先要安装node,npm 前端支持的基础文件

npm包管理,使用cnpm下载速度更快

npm install -g cnpm --registry=https://registry.npm.taobao.org

Hexo框架安装

1.框架安装

cnpm install -g hexo-cli

2.创建一个空文件夹,在文件下创建博客

mkdir blog

3.hexo 的生成,初始化博客

sudo hexo  init

4.博客启动 start

hexo s

可以本地预览

http://localhost:4000

5.编辑新文章

hexo n "文章名称"

hexo g 生成

部署到Github

1.安装github部署的工具

cnpm install --save hexo-deployer-git
vim _config.yml

配置文件

 # Deployment
 ## Docs: https://hexo.io/docs/deployment.html
 deploy:
    type: git
    repo: https://github.com/GeekDengshuo/GeekDengshuo.github.io.git
    branch: master

2.部署命令

hexo d

Hexo创建博客基本操作

// 1.init
hexo init [folder]     // Initializes a website. If no folder is provided, Hexo will set up the website in the current directory.

// 2.new
hexo new [layout] <title>
// Creates a new article. If no layout is provided, Hexo will use the default_layout from _config.yml.
// If the title contains spaces, surround it with quotation marks.

//3.generate
hexo generate

//Option    Description
//-d, --deploy  Deploy after generation finishes
//-w, --watch   Watch file changes
//-b, --bail    Raise an error if any unhandled exception is thrown during generation
//-f, --force   Force regenerate
//-c, --concurrency Maximum number of files to be generated in parallel. Default is infinity

// 4.publish
hexo publish [layout] <filename>

// 5.server
hexo server
// Starts a local server. By default, this is at http://localhost:4000/.
//Option    Description
//-p, --port    Override default port
//-s, --static  Only serve static files
//-l, --log Enable logger. Override logger format.

// 6.deploy
$ hexo deploy  //Deploys your website.

//Option    Description
//-g, --generate    Generate before deployment

// 7.clean
$ hexo clean
//Cleans the cache file (db.json) and generated files (public).

hexo g   // hexo generate

hexo s   // hexo server

hexo d   // hexo deploy

Hexo主题皮肤更换

1.克隆主题

git clone https://github.com/litten/hexo-theme-yilia   下载主题
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia  // 拷贝到主题目录下

2.修改_config.yml

vim _config.yml
# Extensions
  ## Plugins: https://hexo.io/plugins/
  ## Themes: https://hexo.io/themes/
  theme: yilia

reference

hexo文档

原文地址:https://www.cnblogs.com/GeekDanny/p/11963755.html

时间: 2024-07-28 17:08:12

基于hexo创建博客(Github托管)的相关文章

在github上使用hexo搭建博客

Hexo是一个简单地.轻量地.基于Node的一个静态博客框架,可以方便的生成静态网页托管在github和Heroku上.引用Hexo作者 @tommy351 的话: 快速.简单且功能强大的Node.js博客框架.A fast, simple & powerful blog framework, powered by Node.js. 要使用Hexo,需要在你的系统中支持Nodejs和Git. 安装git客户端 根据自己的系统选择合适的git客户端进行安装.官网:https://git-scm.c

Github + Hexo 搭建博客

服务加速 brew 加速 http://blog.suconghou.cn/post/homebrew-speedup/ github加速 http://www.selfrebuild.net/2016/11/01/github-fast-host/ 零基础搭建博客 brew 安装指定版本的 nodejs http://blog.csdn.net/jonahzheng/article/details/51967438 hexo 命令创建博客 http://blog.csdn.net/jzooo/

github+hexo搭建博客

引言 之前用阿里云弹性web托管采用wordpress搭建的个人博客,经过我使用一段时间之后发现存在很多问题: 网站的响应速度非常慢,估计打开主页需要3-4s的时间,我经过搜索发现很多人都有这样的问题,所以应该不是wordpress的锅,而是阿里云弹性web托管的问题,毕竟我买的时候一年只要几百块,而且还是最便宜的经济版(内存128M+2G网页空间+4G流量+1G数据库).其实我后来才知道弹性web托管是一个啥玩意 ,和虚拟机差不多,性能非常有限.可惜我当时不知道啊,否则应该买云虚拟主机独享版的

基于 Laravel 开发博客应用系列 —— 从测试开始(一):创建项目和PHPUnit

1.创建博客项目 我们将遵循上一节提到的六步创建一个新 Laravel 5.1 项目的步骤,创建本节要用到的博客项目 —— blog. 首先,在本地主机安装应用骨架: [email protected]:~/Code$ composer create-project laravel/laravel blog --prefer-dist 接下来,编辑 Homestead.yaml,添加站点信息及数据库信息: sites: - map: test.app to: /home/vagrant/Code

Django创建博客应用

最近在看一篇全栈增长工程师实战,然后学习里面的项目,结果发现作者用的技术太过老旧,好多东西都已经被抛弃了,所以结合着官方文档和自己的一些理解将错误的信息替换一下,边写边学习 准备工作和工具 作者说需要一些python基础,但是中国程序员是最好的程序员,没有基础照样看,大不了遇到不懂的现学就是喽 需要在计算机上安装一些工具 Python环境及包管理工具pip 一款浏览器,推荐Chrome,当然,用自己喜欢的浏览器也可以 版本控制,推荐用Git,但是很多培训机构出来的只会SVN,所以这个没有什么重要

Hexo+git博客搭建

前言 早就想换一换我之前使用的wordpress博客了,昨天偶然看到一个学长的博客感觉前端简洁大气,于是查了一下他所用的Hexo这个博客框架.从doc来看使用简单,md的编辑方式很高效,浏览了一下主题也有几个不错的,于是趁着考试周之前的日子赶紧把博客搭建起来了. 搭建的环境是Mac+Ubuntu14.04 本地安装搭建博客 本地安装hexo框架 先使用homebrew安装npm: 1 brew install npm 使用npm安装Hexo 1 npm install hexo-cli -g 安

多Git账户以及Hexo搭建博客进阶

多Git账户以及Hexo搭建博客进阶 1.生成密钥 可以看到已经生成的id_rsa是0LinkSec git账户的密钥 而yof3ng的则是我准备搭建的第二个hexo的密钥 2.配置ssh config文件(ssh目录下新建config文件) #userName1 Host 0LinkSec HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa ? #userName2 Host yof

hexo同步博客

hexo搭建过程网上很多,这里就不叙述.主要说说在不同电脑之间同步hexo博客. 远程仓库的创建 可以使用github.OSC.coding等等,最好选择私有库,由于github只能私有库不是免费的,想节省点的可以选择免费的私有库(比如OSC.coding). 将git SSH公钥添加至远程仓库. .gitignore操作 在hexo根目录下新建或打开.gitignore 1234 /.deploy_git/public /_config.yml/node_modules /.deploy_gi

linux中安装hexo编译博客

title: linux中安装hexo编译博客 categories: 运维 date: 2019-10-29 01:41:10 tags: linux toc: true --- 背景 几天前就看到服务器要到期了,没去管他,结果给忘了,今天凌晨过期了,这台阿里云华东2(上海)的机器也用了快2年了,物理位置在上海让我这个强迫症很不舒服,而且40G的盘都用了30G了(反正就是给自己各种不嫌麻烦的借口),看到新出的学生机有可以购买在华东1(杭州)就果断释放了原来的服务器,新购于杭州节点 之前用宝塔做