Based hexo create a blog (Github hosting)

Based hexo's blog

Build step

  • 1. Download the file dependent Node.js

  • 2.Hexo installation

  • 3. deployed to Github

  • 4.Hexo basic operations to create a blog

  • 5.Hexo theme skin replacement

Dependent files Node.js

You must first install node, npm front-end support base file

npm package management, faster download speeds using cnpm

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

Hexo frame mounting

1. The mounting frame

cnpm install -g hexo-cli

2. Create an empty folder , create a blog in the file

mkdir blog

3.hexo generation, initialization blog

sudo hexo  init

4. Start start blog

hexo s

Local can preview

http://localhost:4000

5. Edit the new article

hexo n "文章名称"

hexo g 生成

Deployed to Github

1. Install tool deployment github

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

Profiles

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

2. Deploy command

hexo d

Hexo basic operations to create a blog

// 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 theme skin replacement

1. cloning theme

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

2. Modify _config.yml

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

reference

hexo document

Guess you like

Origin www.cnblogs.com/GeekDanny/p/11963755.html