Recommended Fast CDN for Chinese Users
To insure the fastest loading speed for the Cnblogs-Theme-SimpleMemory plugin for users in China, leveraging a content delivery network (CDN) with local nodes is crucial. A highly recommended option is jsd.cdn.zzko.cn.
You can update the plugin's script source URL to use this CDN. The format is:
https://jsd.cdn.zzko.cn/gh/BNDong/Cnblogs-Theme-SimpleMemory@{version}/dist/simpleMemory.js
For instance, to load version v2.1.7, the complete <script> tag would be:
<script src="https://jsd.cdn.zzko.cn/gh/BNDong/Cnblogs-Theme-SimpleMemory@v2.1.7/dist/simpleMemory.js" defer></script>
Alternative Global CDN
Another widely-used global CDN is cdn.jsdelivr.net. While reliable, its performance can vary depending on the user's location and internet service provider.
- URL Format:
https://cdn.jsdelivr.net/gh/BNDong/Cnblogs-Theme-SimpleMemory@{version}/dist/simpleMemory.js
Advanced Technique: Automatic Version Updates
For a hands-off approach that automatically loads the latest plugin version, you can use JavaScript to fetch the latest release tag from the GitHub API and dynamically construct the script URL.
Insert the following script into you're blog's sidebar announcement:
<script>
async function fetchData(endpoint) {
const options = {
method: 'GET',
mode: 'cors',
};
const response = await fetch(endpoint, options);
return response.json();
}
// Fetch the latest release information from GitHub
fetchData('https://api.github.com/repos/BNDong/Cnblogs-Theme-SimpleMemory/releases/latest').then(releaseInfo => {
// Construct the script URL using the recommended Chinese CDN
const scriptUrl = `https://jsd.cdn.zzko.cn/gh/BNDong/Cnblogs-Theme-SimpleMemory@${releaseInfo.tag_name}/dist/simpleMemory.js`;
// Dynamically load the script
$.ajax({
type: 'GET',
dataType: 'script',
url: scriptUrl,
success: function() {
console.log('SimpleMemory plugin loaded successfully.');
},
error: function(err) {
console.error('Failed to load SimpleMemory plugin:', err);
}
});
});
</script>
Configuration Steps
- Log in to you're Cnblogs account and navigate to the Admin Dashboard.
- Locate the "Blog Sidebar Announcement" setting.
- Paste the chosen
<script>tag (either the static or auto-update version) into the announcement box. - If using the static version, remember to replace
{version}with the desired version number (e.g.,v2.1.7). This step is not needed for the auto-update script. - Save your changes.
Note: Utilizing the SimpleMemory theme requires that your Cnblogs account has JavaScript execution permissions enabled.