zoukankan      html  css  js  c++  java
  • 基于hexo创建博客(Github托管)

    基于hexo的博客

    搭建好的博客网站 dengshuo7412.com

    搭建步骤

    • 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文档

  • 相关阅读:
    pureftp 超时 mlsd
    安卓相机调用适配
    解决多个界面重复共用同一组数据导致数据同步改变(实现数据的完全深拷贝)
    PHP反射API的使用、体会、说明
    c冒泡排序
    iOS开发常用的第三方类库
    修改按钮上图片的大小-iOS
    获取手机通讯录--ios
    根据搜素的字符串改变label包含该字符串的文字
    cell点击按钮崩的一种情况
  • 原文地址:https://www.cnblogs.com/GeekDanny/p/11963755.html
Copyright © 2011-2022 走看看