美文网首页
使用Hexo搭建博客框架

使用Hexo搭建博客框架

作者: 酵母小木 | 来源:发表于2020-09-14 19:34 被阅读0次

To record some basic operations about Hexo and test some new ideas, I decided to create a blog again!

1. Build the website

  • First, we need to build the Hexo Framework.
  1. Enter the user’s content:

    $  cd ~/
    
  2. Creat a new folder to store the website:

    $  mkdir BlogTest    
    
  3. Enter the Website’s content:

    $  cd BlogTest
    
  4. Install the Hexo into the folder: (If you have done this, skip it)

    $  npm install -g hexo
    
  5. Build a new website:

    $  hexo init
    
  6. Build the content:

    $  npm install
    
  7. Build a new Blog:

    $  hexo new "title"        
    
  8. Generate the static files:

    $  hexo generate
    
  9. Start server: (Website: http://localhost:4000/)

    $  hexo server 
    
  • Next, in your github, you need to build a new Repository:

    username.github.io(eg.BlogTest.github.io)

  • Then you can install Git-deployer-Plug-in.

    $ npm install hexo-deployer-git --save    
    
  • Finally, deploy your _config.yml.

    deployway

And in the end of this, you will find as follows:

deploy
  • So you need to change it.

    deploy: 
          type: git 
          repo: https://github.com/username/name.github.io.git(eg.https://github.com/Yeast/BlogTest.github.io.git).
          branch: master
    

Note that the colon is followed by a space. Then you can deploy your website from local to Github.

Common commands

  • Common commands:
  1. Generates static files

    $ hexo generate
    
  2. Deploy the website

    $  hexo deploy
    
  3. Cleans the cache file (db.json) and generated files (public).

    $  hexo clean
    
  4. List sources in this website

    $  hexo list
    
  5. Show the hexo’s version

    $  hexo version
    

I just want to record some common operations that I will use usually. Hope it can help you. If you want to know more, you can visit the Commands.

References

  1. 官方文档.
  2. Mac下使用Hexo和Github搭建静态博客

相关文章

网友评论

      本文标题:使用Hexo搭建博客框架

      本文链接:https://www.haomeiwen.com/subject/ajzkektx.html