README
hexo-cdn-jsdelivr
English | 简体中文
Introduction
A hexo plugin to help you automatically use jsDelivr CDN for Github to speed up the loading of static resources like images.
If you want to use CDN for the static resources of your hexo website, jsDelivr provides an open-source CDN.
You may want to use this plugin and jsDelivr CDN when:
Speed up the loading of static resources of your Hexo website
Avoid inconsistent website access experience in different regions. For example, Github Pages is very slow to visit in China
Save the bandwidth of your server
Installation
$ npm install hexo-cdn-jsdelivr --save
You may come across some problems when using node 8.x version. We recommend that you use node >= 10.x version.
Options
You can configure this plugin in _config.yml
.
jsdelivr_cdn:
# If use_cdn is false, this plugin will not work
use_cdn: true
# If deploy_when_generating is true, the assets repository will be pushed to github every time you generate the hexo project using 'hexo g' command. If this flag is set false, the repository will be pushed when deploying. You can manually push the assets repository to github when generating by using 'hexo g cdn' command.
deploy_when_generating: true
# cdn_url_prefix is the jsdelivr cdn url of your github repository(the assets repository for static assets rather than the hexo project deployment repository), it should be like: https://cdn.jsdelivr.net/gh/<username for github>/<assets repo name>/
cdn_url_prefix: <the url of jsdelivr cdn for your github repository>
# git_repo_url is the url of your new assets repository on github, it should be like git@github.com:<username>/<repo>.git
git_repo_url: <git repository url>
# you can use github token to push your assets repository. If you don't want to use a token, you can use a empty string '' or comment out this line. We do not recommand that you directly write your token in the _config.yml. We suggest that you read the token from the environment variable by setting token with a prefix '