Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/njzjz/hexo-image-cloudflare
Use Cloudflare to cache images in Hexo
https://github.com/njzjz/hexo-image-cloudflare
Last synced: 2 months ago
JSON representation
Use Cloudflare to cache images in Hexo
- Host: GitHub
- URL: https://github.com/njzjz/hexo-image-cloudflare
- Owner: njzjz
- License: mit
- Created: 2020-07-26T19:12:32.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-16T11:15:47.000Z (almost 2 years ago)
- Last Synced: 2023-08-06T05:04:38.416Z (over 1 year ago)
- Language: JavaScript
- Size: 1.44 MB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hexo-image-cloudflare
A hexo plugin to use Cloudflare to cache images, powered by [images.weserv.nl](https://images.weserv.nl/).
## Installation
```
npm i hexo-image-cloudflare
```## Usage
After installing the plugin, all image urls will be converted to CDN urls automatically. For example, the origin markdown file is
```md
![Work/Life Balance](https://drive.google.com/uc?id=1PElTKhhNIPYSuoXIQtwTyq-RcWKA5MYd&export=download)
```Then it will be converted to
```md
![Work/Life Balance](https://images.weserv.nl/?url=https://drive.google.com/uc?id=1PElTKhhNIPYSuoXIQtwTyq-RcWKA5MYd&export=download)
```The local image urls will be also converted. For example, the original file is
```md
![Work/Life Balance](/img/anti996.png)
```It will be rendered as
```md
![Work/Life Balance](https://images.weserv.nl/?url=https://your.blog/img/anti996.png)
```where `https://your.blog` is the url of your blog that you set in `_config.yml`.
## Configuration
You can custom the [CDN server url](https://github.com/weserv/images) in `_config.yml`, and the default value is `https://images.weserv.nl`.
Some other configurations are avaible.```yaml
cdn:
server: https://images.weserv.nl
use_webp: false
native: false # use cloudflare native image resize
max_width:
exclude_domains:
```