Ghost博客添加对象云存储支持

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

环境准备

qn-store - 七牛云支持插件

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

安装

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

安装依赖包

1
2
cd qn-store
npm install

配置

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 文件夹下
1
2
cd [path/to/ghost]/content/storage
git clone https://github.com/sanddudu/upyun-ghost-store.git

安装依赖包

1
2
cd upyun-ghost-store
npm install

配置

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

1
2
3
4
5
6
7
8
9
10
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

文章作者: 陈高勋
文章链接: https://nmchgx.com/ghostblog-object-storage/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 陈高勋的博客