标签归档:hexo

Hexo在GitHub及gitee配置小记

问题小记

  • hexo d操作后将源代码上传而不是上传静态网页 解决方案是设置git账户,
    $ git config --global user.name "liuxianan"// 你的github用户名,非昵称
    $ git config --global user.email  "xxx@qq.com"// 填写你的github注册邮箱

    猜测还有可能是因为cloud studio的不稳定性

成果

参考文献

Linux后台运行hexo

hexo是一个非常高效的博客,但由于其设计特点,目的是为了转换为静态页面,因此不必要一直在后台运行,但是我想随时随地写博客同步到github,使用hexo admin编辑器,这就需要hexo一直在后台运行,于是在网上找到了pm2托管的方式。

首先安装pm2

$ npm  install -g pm2

第二步,写一个运行脚本,在博客根目录下面创建一个hexo_run.js

//run
const { exec } = require('child_process')
exec('hexo server',(error, stdout, stderr) => {
        if(error){
                console.log('exec error: ${error}')
                return
        }
        console.log('stdout: ${stdout}');
        console.log('stderr: ${stderr}');
})

第三步,cd到博客根目录下运行脚本

# pm2 start hexo_run.js

参考文献

让hexo一直在后台运行

Hexo右上角添加GitHub Corner

使用hexo主题及github发布了博客,想在现有博客上添加一个github corner,于是使用下面的方法,由于我只想在主页添加,于是在主题目录下找到index.swig文件,添加如下代码:

<a href="https://your-url" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#fff; color:#151513; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>