CDN_jsdelivr

Posted on May 6, 2019

blog引用资源路径由本地替换为CDN

内容分发网络(Content Delivery Network),依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞,提高用户访问响应速度和命中率。

由于GitHub资源在国内加载过慢,有很多人选择通过CDN来提高资源加载速度:免费、速度快的jsdelivr,CDN的本质是缓存。

1. 在GitHub上Create a new repository

得到repository name

2. clone 这个仓库到本地

在文件夹下git bash here

git clone 你的仓库地址

3. 上传资源

git status   # 查看仓库状态
git add .    # 所有文件添加至缓存区
git commit -m "your_commit"
git push     # 推送至远端仓库

4. 发布仓库

点击releases,版本号自定义

5. 引用资源

通过路径:

https://cdn.jsdelivr.net/gh/user/repo@version/file
https://cdn.jsdelivr.net/gh/你的github用户名/你的仓库名@发布的版本号/文件路径

可以CDN引用资源啦~