JsDelivr is one of the best public CDN service providers in China and the first “free CDN service between mainland China and overseas”. JsDelivr has a very useful feature — it speeds up files in the Github repository. We can build a free, globally accessible map bed.
Note: Static files are mainly cached on jsDelivr’s CDN nodes, ensuring that GitHub is under minimal load, and you can also get quick and easy hosting of static files from GitHub repositories.
jsDelivr is a public, open-source CDN (Content Delivery Network) developed by ProspectOne, focused on performance, reliability, and security. It is free to use for everyone, with no bandwidth limits.
jsDelivr is the only public CDN with a valid ICP license issued by the Chinese government, and hundreds of locations directly in Mainland China.
The main idea
Use PicGo to upload the image to the specified Github repository location and jsDelivr to get the accelerated URL of the image.
Use effect: Click to access the test picture
Making configuration
First you need to create a Github repository and obtain a token (which gives the application access to the repository).
-
Visit github.com/settings/to…
-
Drag to the bottom and click Generate Token to Generate and copy.
PicGo configuration
-
For Windows, click the bottom of the.exe file.
-
Install, open PicGo, and configure Github map bed in “Map Bed Settings”.
-
- Set the warehouse name: Fill in the name of the warehouse you created above in the format:
Username/warehouse name;
- Set branch name: General
master
We have to do is; - Set Token: Paste the Token obtained in Github configuration.
- Specify the storage path: where do you want the image stored in the warehouse, for example I am:
static_files/iljw/img/large
, Github corresponds to:
- Set the warehouse name: Fill in the name of the warehouse you created above in the format:
JsDelivr configuration
This is actually the last PicGo configuration item from the previous section — setting the custom domain name. My Settings are:
https://cdn.jsdelivr.net/gh/joeyliu6/Blogger@master
Copy the code
Among them:
gh
Represents a repository from Githubjoeyliu6/Blogger
The specific location of the warehousemaster
Branch of warehouse
Ok, configuration is done here. The link form is as follows:
https://cdn.jsdelivr.net/gh/joeyliu6/Blogger@master/static_files/iljw/img/large/20190512151852.png
Copy the code
PicGo allows you to upload pictures easily, it supports drag and drop, click, clipboard upload, after uploading, image links directly copied into your clipboard.
Of course, you can also use Git command to batch upload local images to Github, and then replace the original image link address, to complete the image migration work.
conclusion
The whole process is relatively simple. Create the Github repository, obtain the token, and fill in the PicGo configuration to complete.
- Accelerate static file access with jsDelivr to optimize the blogging experience.
- Storing images on Github helps bloggers control their images.
- The reason for using PicGo is the ability to easily upload images to Github and get jsDelivr’s accelerated image address directly.
The Github repository has a maximum capacity of 1 gigabyte, which is more than enough for personal blogs, and I currently use around 10 gigabytes of images for my blog. To use it 100%, I’d have to have at least a thousand posts.
Reprinted from: blog.iljw.me/2019/05/ JSD…