Skip to content

🚀 Shiro v1.3.2 Released: Automatic Cache-Busting for Static Assets

Latest

Choose a tag to compare

@Acris Acris released this 14 Mar 14:13
47f51d4

A minor release that eliminates the need to manually purge CDN/Cloudflare caches after theme updates. All local CSS and JS assets now include a content-based hash in their URLs, ensuring browsers always load the latest version.

✨ New Features

🔄 Automatic Cache-Busting with versioned_url Helper

Added a new versioned_url Hexo helper that appends a ?v=<hash> query parameter to local asset URLs. The hash is derived from the file's MD5 content digest (first 8 characters), so the URL only changes when the file content actually changes.

  • No more manual cache purging — after deploying a new version, browsers and CDNs will automatically fetch updated assets because the URL has changed.
  • Zero configuration required — the helper works out of the box with no additional settings.
  • Graceful fallback — if a file is not found at the theme level, the helper falls back to the standard url_for output without a version parameter.

Example output:

css/style.min.css?v=69bbab69
js/lightgallery.js?v=a1b2c3d4

🔧 Improvements

Asset Loading

  • Replaced all url_for calls for local CSS and JS assets with the new versioned_url helper across layout templates:
    • layout/_partial/common/head.njkstyle.min.css
    • layout/_layout.njklightgallery.js, clipboard.js, toc.js, progress.js, theme-toggle.js, mobile-menu.js

Documentation

  • Updated version references in package.json, _config.yml, README.md, and README_CN.md.

🛠️ Upgrade Notes

To update your theme to the latest version, use the method matching your installation:

npm

npm i hexo-theme-shiro@latest

Git

cd themes/shiro
git pull

Note: After upgrading, review the default _config.yml for any new or changed options, and update your _config.shiro.yml accordingly.

This release is fully backward compatible — no configuration changes are required. Simply update the theme files and rebuild your site.

🤝 Feedback

Thank you for using Shiro! If you encounter any issues with the new features or have suggestions, please feel free to open an issue.

If you enjoy using Shiro, please consider giving it a ⭐️ on GitHub to support my work!

Full Changelog: v1.3.1...v1.3.2

Made by Acris with ❤️