WordPress CMS Theme: WordPress uses jsDelivr+Github to achieve free global CDN acceleration, WordPress uses other ports

One year ago (2023-11-26) Chief Editor
8 minutes
three hundred and ninety-three
zero

The introduction believes that many developers are no strangers to jsDelivr and GitHub. Many WordPress webmasters may not know how to use static resources to realize free CDN acceleration scenarios through jsDelivr. Today, Huige will teach you how to use jsDelivr+Github to realize free CDN acceleration. Note: This idea and idea is only Huige's personal idea and implementation. The final operation and implementation depends on the technology. If you think this content is useless or too simple, please read more articles about this related content by yourself. PS, But after all, there are other websites running on the server, and the concurrency will be very high when users visit at the same time. Even if CDN can help solve most of the requests, there is still some content that needs to be returned to the source. In addition, CDN traffic packets are used up, and old users are very expensive to buy, what should we do? So Huige came up with the idea of jsDelivr and Github. Usually when developing front-end content, many Js need to be loaded, such as JQuery. At that time, many developers will directly reference from jsDelivr, so Huige came up with the idea that if you put the static files of WordPress on GitHub, use jsDelivr for caching, and then use the CDN link of jsDelivr for reference, So when users visit the website, they only load a small amount of dynamic resources from the server, and a large number of static resources are loaded through the CDN of jsDelivr. This can reduce both the server's requests and the use of CDN traffic. Why not! Why use jsDelivr? JsDelivr is a service that provides static resources frequently used on the Web, including JavaScript libraries, jQuery plug-ins, CSS frameworks, fonts, etc. It uses global CDN acceleration to ensure that users in every region can get the best link speed. Using domestic CDN acceleration in mainland China, jsDelivr can use different JavaScript or CSS libraries together, JsDelivr provides image services for projects such as package buckle npm GitHubWordPress. The most important thing is that jsDelivr uses low latency CDN nodes of the network host in China. Here is a screenshot of the domestic delay of the jsDelivr test.

Official website: //www.jsdelivr.com Acceleration address: //cdn.jsdelivr.net Example: Just like using the bootstrap. min. js file in the GitHub repository to accelerate the original GitHub address with jsDelivr //github.com/twbs/bootstrap/blob/main/dist/js/bootstrap.min.jsjsDelivr Acceleration address //cdn.jsdelivr.net/gh/twbs/bootstrap @Main/list/js/bootstrap. min.js If you classify by version, release a version of v4.6.1, and the connection address in GitHub is //github.com/twbs/bootstrap/blob/v4.6.1/dist/js/bootstrap.min.jsjsDelivr The acceleration address of is //cdn.jsdelivr.net/gh/twbs//dist/js/bootstrap.min.js If there are multiple versions in GitHub and you want to ignore the version and load the latest version directly, you can use the latest tag jsDelivr to ignore the version and load the latest version //cdn.jsdelivr.net/gh/twbs/bootstrap @Latest/list/js/bootstrap. min.js Preparation Note: Huige uses the WordPress+b2 theme. Other themes operate similarly to this theme. The following Huige operations and demonstrations are based on the WordPress+b2 theme. Git and WebStorm tools can use other tools instead. WordPress website b2 theme Git (optional) Windows installs Git convenience version and configures environment variables: //www.haah.net/archives/6383.html Add ssh keys to your GitHub according to the following article. The process is to copy the contents of the generated ssh keys file and open //github.com/settings/keys , click New SSH Key, enter the name, and paste the key in to complete the detailed tutorial of IDEA configuration code cloud Gitee: //www.haah.net/archives/6395.htmlWebStorm (Not required) IntelliJ WebStorm 2021.3 Green Easy Edition: //www.haah.net/archives/7020.html Huige Final Effects Tutorial (the content may be too long, please read patiently) PS: The content of jsDelivr cache cannot exceed 50MB, please carefully check whether the resources uploaded by yourself are greater than 50MB, if it is larger than 50MB, please delete useless files by yourself, jsDelivr can only cache static resources, note that it is static resources, if you do not know what is static resources, please Baidu! If you encounter Git errors in this process, please Baidu to solve them! 1. Create a GitHub repository. 2. Download the website root directory/wp content/plugins folder and themes folder to the computer. 3. Pull the GitHub repository 3.1 in WebStorm. Find the code in the repository. SSH>Copy the link at the beginning of the git 3.2. Open WebStorm, click Get from VCS in the upper right corner, select git for version control, and fill in the URL with the link copied in step 3.1 above, The directory can be customized, and then click Clone 4. Copy the website file downloaded in step 2 to 4.1 under WebStorm. Select the locally downloaded website file, and then Ctrl+C copy 4.2. Click the warehouse name in the upper left corner, and then Ctrl+V paste 5. Add the file to the Git local cache warehouse. If the file pops up automatically after pasting and you can add it, click Add directly, At that time, you can ignore this step 6. Submit the modification to GitHub7. Check whether the submission is successful in 7.1. The easiest way is to refresh the Github page to see 8. Get the jsDelivr link. The reason why jsDelivr is used is mentioned in the above example. Let's demonstrate again. The example file is smartideo.css8.1. Find and open the smartideo.css file. Here we see the link is: //github.com/haahs/Res/blob/master/wp-content/plugins/smartideo/static/smartideo.css8.2 The link to jsDelivr is: //cdn.jsdelivr.net/gh/haahs/Res @Master/wp content/plugins/smartideo/static/smartideo.css9. Replace the links in the website file. Here is a simple example 9.1. PHP replacement example 9.2. CSS replacement example PS: Other files can be replaced according to the above example. In fact, the principle of the end is very simple. Pfigo uses simple operation methods and omits some unnecessary operations, You may encounter various problems during the operation. You can leave a message in the comment area below, and I will try my best to help you solve them! If the theme used is not B2, it can be operated, even any program can use this operation (as long as static resources are loaded). If you still don't understand, you can leave a message or contact Huige!

This article is written by: Chief Editor Published on Software Development of Little Turkey , please indicate the source for reprinting: //hongchengtech.cn/blog/712.html
Kuke_WP editor
author

Related recommendations

1 year ago (2024-02-20)

What are the main contents of wms system in warehouse management

Original title: What does the wms system mainly embody in warehouse management? What does the wms system mainly embody in warehouse management? Warehouse management has standardized and intelligent process oriented management. A good warehouse management mechanism can improve the efficiency of warehouse managers, relieve their pressure, and complete efficient and accurate work. 1. Warehouse management is accompanied by the progress of the times
1 year ago (2024-02-18)

How to implement the mptt comment function of CMS content management system in Django?, Django management page

During the daily development of content related Web systems in the directory, whether it is Blog or CMS, if you need to add links to interact with users, you must need the comment function. Next, you can implement the comment reply function in Django based on Python's MPTT framework. Note: Because the user comment function will involve a
three hundred and ninety-four
zero
1 year ago (2024-02-18)

Best CMS content management system in 2022, good novel in 2021

Looking for the best CMS software to build your website? At a high level, CMS or content management systems can help you create functional websites without having to use code to build every page from scratch. However, different CMS software has different advantages and disadvantages, so you need to choose the tool that best suits your specific needs and budget. To help, we accept
four hundred and six
zero
1 year ago (2024-02-18)

Shenzhen promotes the access of 5G base station energy storage system to the virtual power plant management center in the city. Does the Shenzhen 5g government subsidize the flow package charge

Xinhua News Agency, Shenzhen, December 14 (Reporter Wang Feng) At the 2022 Carbon Peak Carbon Neutralization Forum and Shenzhen International Low Carbon City Forum held here in Shenzhen, Shenzhen Virtual Power Plant Management Center signed a cooperation agreement on virtual power plant construction with China Tower, China Telecom, China Mobile, China Unicom, Huawei Digital Energy and other units on the 13th, which will jointly promote the city's 5G base station energy storage system
three hundred and forty-three
zero
1 year ago (2024-02-18)

Common website cms content management system recommendation, common website cms content management software

CMS is the abbreviation of "Content Management System", which means "Content Management System" in Chinese. These systems have developed common website functions and provided them to users for download, greatly improving the efficiency of website construction. The most common functions of CMS are column management, article management, product management, picture management
three hundred and twenty-eight
zero

comment

0 people have participated in the review

Scan code to add WeChat

contact us

WeChat: Kuzhuti
Online consultation: