Hello,Sunday


  • Home

  • Archives
GitHub E-Mail

HelloWorld!

Posted on 2022-09-01 | In Word

github blog


参考文章

- https://zhuanlan.zhihu.com/p/75438236

环境

- MAC
- 已经注册github
- 本地已经可以使用了git

安装步骤

1 需要安装node.js、npm和Git
    $ sudo npm install -g hexo-cli
2 安装 hexo
    $ sudo npm install -g hexo
3 验证
    $ npm -v
 $ node -v
 $ Git --version
4 创建文件夹。例如new
    $ mkdir new
    $ cd new
5 初始化目录
    $ hexo init
6  安装 npm
    $ sudo npm install
7 生成本地页面
    $ hexo g
8 本地调试
    hexo s --debug
9 上传代码,修改配置文件
    $ nano _config.yml
    '''
    deploy:
        type: git
        repository: https://github.com/****/****.github.io.git
        branch: master
    '''
    - 注意type、repository、branch后均有空格
10 上传
    $ hexo d
    - 若执行hexo g出错则执行npm install hexo --save,若执行hexo d出错则执行npm install hexo-deployer-git --save。错误修正后再次执行hexo g和hexo d上传到服务器。
    - 行成功后便可通过https://*hxf23638691**5*.github.io
11  绑定域名
    - 在文件夹new中的punlic里面创建CNAME(文本格式),里面写入域名,在DNS解析的地方添加CNAME记录
12 安装主题
    - 在new文件夹里,输入
        $ git clone https://github.com/iissnan/hexo-theme-next themes/next
    - 将blog目录下_config.yml里的theme的名称landscape更改为next。

13 再次部署
    - 执行如下命令(每次部署文章的步骤)
    $ hexo g  //生成缓存和静态文件
    $ hexo d  //重新部署到服务器
14 本地博客部署到服务器后,网页端无变化时可以采用下述命令。
    $ hexo clean  //清楚缓存文件(db.json)和已生成的静态文件(public)
15 NexT 官网
    - http://theme-next.iissnan.com/

写作

1 首先创建一个md文件
    $ hexo new 文件名
2 然后在博客文件夹目录下的source-_posts打开

问题

1、 hexo使用theme出现“ {% extends ‘_layout.swig‘ %} {% import ‘_macro/post.swig‘ as post_template %}“问题
原因是hexo在5.0之后把swig给删除了需要自己手动安装

$ npm i hexo-renderer-swig

Hello World

Posted on 2022-09-01

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

Tom Liu

Tom Liu

技术探索者 | 终身学习者

2 posts
1 categories
1 tags
GitHub E-Mail
GitHub E-Mail
© 2022 Tom Liu
Powered by Hexo
|
Theme — NexT.Muse v5.1.4