zoukankan      html  css  js  c++  java
  • 使用hexo搭建github博客


    Win7系统已经安装了node.js和npm

    npm install -g hexo-cli    全局安装hexo客户端
    
    hexo init blog             在喜欢的位置初始化blog目录
    
    cd blog
    
    npm install               根据packages.json安装依赖包
    
    hexo s(erver)           启动本地服务器 http://localhost:4000/   浏览器访问效果如下

    基本命令
    
    hexo new "A new post"     Create a new post in source/_post/
    
    hexo s   /  server       Runserver   localhost:4000
    
    hexo g  /generate      Generate static files in public/
    
    hexo d  /deploy          Deploy to remote sites like github
    安装主题和插件(有的可能还要安装依赖包,具体按网站上的要求安装即可)
    
      插件 npm install   hexo-deployer-git   --save          Install to blog/node_modules    --save会把安装的包写入到package.json的dependencies
    
      主题   git clone https://github.com/wizardforcel/hexo-theme-landfarz.git    themes/landfarz 
    配置文件 blog/_config.yml
    
      主题 theme: landscape(默认)
    
      部署 deploy:
    
          type: git      (已经安装了hexo-deployer-git)
    
          repo: https://github.com/suqingdong/blog.git     push不了改成ssh地址即可
    
          brancd: gh-pages

    不知何因,hexo-deployer-git安装不上(还是网络原因,代理安装就好了...)

    可以手动吧public/下的文件push到github上

    cd public
    
    git init
    
    git remote add origin https://github.com/suqingdong/blog.git
    
    git add .
    
    git commit -m "init blog"
    
    git push origin gh-pages

    现在访问 https://suqingdong.github.io/blog
    
    

    写新文章

    1 hexo new "a new post"   
    
    2 编辑 source/_posts/a-new-post.md  可以使用markdown编辑器编写内容(网页版的马克飞象不错)
    
    3 hexo g     生成html等静态文件
    
    4 git push origin gh-pages  (public目录中) 推送到github上

    推荐主题 - maupassant

    Maupassant最初是由Cho大神为Typecho平台设计开发的一套响应式模板,体积只有20KB,在各种尺寸的设备上表现出色。由于其简洁大气的风格受到许多用户喜爱,目前也已经被移植到了多个平台上

    安装
    $ git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant
    $ npm install hexo-renderer-jade --save
    $ npm install hexo-renderer-sass --save   报错可能是网络原因,可以使用代理安装或者使用淘宝npm镜像

      

    KEEP LEARNING!
  • 相关阅读:
    动态传参
    函数的介绍
    文件的操作
    send email with formatted table
    minimize and close window with customed winform
    python algorithm
    something important about docker
    book list
    which language is suitable for what to do
    Find Duplicate Items in list fast
  • 原文地址:https://www.cnblogs.com/roronoa-sqd/p/5507288.html
Copyright © 2011-2022 走看看