Skip to content

官方原版的Ghost 博客是不支持对象云存储的,平时习惯了图像等资源存储到七牛云又拍云,于是寻觅 Github 果然有人分别做了插件提供支持,很感谢@sanddudu@Minwe两位作者。下面介绍下如何来使用两款插件。

环境准备

qn-store - 七牛云支持插件

qn-store这款插件是给 Ghost 博客提供七牛云存储支持。安装方法如下:

安装

  • content 文件夹中创建一个名为 storage 的文件夹
  • 将本仓库克隆至 storage 文件夹下
bash
cd [path/to/ghost]/content/storage
git clone https://github.com/Minwe/qn-store.git

安装依赖包

bash
cd qn-store
npm install

配置

配置 Ghost 根目录下的 config.js 将原有的 storage 部分替换为下面配置:

javascript
storage: {
    active: 'qn-store',
    'qn-store': {
        accessKey: 'your access key',
        secretKey: 'your secret key',
        bucket: 'your bucket name',
        origin: 'http://xxx.bkt.clouddn.com',
        fileKey: {
            safeString: true,
            prefix: '[images]/YYYY/MM/',
            suffix: ''
        }
    }
}

更多参数的设置详见插件的官方说明:qn-store

upyun-ghost-store - 又拍云支持插件

upyun-ghost-store这款插件是给 Ghost 博客提供又拍云存储支持。安装方法如下:

安装

  • content 文件夹中创建一个名为 storage 的文件夹
  • 将本仓库克隆至 storage 文件夹下
bash
cd [path/to/ghost]/content/storage
git clone https://github.com/sanddudu/upyun-ghost-store.git

安装依赖包

bash
cd upyun-ghost-store
npm install

配置

配置 Ghost 根目录下的 config.js 将原有的 storage 部分替换为下面配置:

javascript
storage: {
    active: 'upyun-ghost-store',
    'upyun-ghost-store': {
        bucket: 'my-bucket', //bucket 名称
        operator: 'somebody', //操作员用户名
        password: 'secret', //操作员密码
        domain: 'http://bucket.b0.upaiyun.com', //空间绑定的域名,必须带 "http(s)://" ,结尾不能有 "/"
        filePath: '[blog]/YYYY/MM/' //文件远端保存地址
    }
}

更多参数的设置详见插件的官方说明:upyun-ghost-store