Hexo blog development-jsDeliver+Github to accelerate image access

A CDN explained

  • CDN (Content Delivery Network, abbreviation: CDN) refers to the computer network system interconnected through the Internet

  • Use the server closest to each user to send music, pictures, movies, applications and other files to users faster and more reliably

  • To improve performance, scalability and low-cost network content delivery to users.

<!--more-->

Two why use jsDeliver

  • The pictures and video resources stored on GitHub may have limited access due to certain factors, which may cause abnormal display of pictures and videos;

  • For the normal display of pictures and videos, CDN can be used for acceleration, so that the resources can be loaded and displayed correctly

  • jsDelivr is a free and open source CDN solution to help developers and webmasters. Contains JavaScript libraries, jQuery plug-ins, CSS frameworks, fonts and other static resources commonly used on the Web

Three how to use

3.1 Project address

jsDeliver: https://www.jsdelivr.com/

 

 

3.2 Applicable platform of jsDeliver

jsDeliver can accelerate resources on npm, GitHub, and WordPress platforms. This article uses GitHub as an example to illustrate

3.3 Instructions for use

// load any GitHub release, commit, or branch
// note: we recommend using npm for projects that support it
https://cdn.jsdelivr.net/gh/user/repo@version/file
  • https://cdn.jsdelivr.net : URL of jsdelivr

  • gh: abbreviation of GitHub (indicating accelerated GitHub resources)

  • user: Username registered on GitHub, such as ( JakeWharton )

  • repo@version: The name and version of the warehouse on GitHub (it can be a newly created warehouse on GitHub or a release warehouse @release version)

  • file: Stored file name + file suffix

Four create a GitHub repository

4.1 Create a warehouse after logging in to GitHub (eg: CDN)

 

4.2 Download the GitHub client and clone the warehouse locally

 

4.3 Push local resources to origin

 

4.4 GitHub updated content

 

Five create GitHub Release version

5.1 Click Releases on the right side of the warehouse to create a Release warehouse

 

5.2 Create Release version, Title and description

 

5.3 After the release is created, as shown below

 

Six hexo usage examples

6.1 commit version

https://cdn.jsdelivr.net/gh/pgzxc/CDN/blog-image/dog.png

6.2 release version

https://cdn.jsdelivr.net/gh/pgzxc/[email protected]/blog-image/dog.png

6.3 Markdown document

## Use of jsdelivr pictures
### A direct use of the warehouse image
![][1]
### Use the released version of the picture
![][2]
[1]:https://cdn.jsdelivr.net/gh/pgzxc/CDN/blog-image/dog.png
[2]:https://cdn.jsdelivr.net/gh/pgzxc/[email protected]/blog-image/dog.png

6.4 Effect

 

Guess you like

Origin blog.csdn.net/Calvin_zhou/article/details/108733518