cachebuster
Last updated Oct 27th, 2020 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn moreCachebuster allows you to easily control whether or not assets are loaded fresh from the server or versioned by a site version setting. Simply append the smartcache Chunk to the end of your asset URLs as seen below.
Using Cachebuster¶
<link rel="stylesheet" href="[[++assets_url]]css/styles.css?nc=[[$smartcache]]">
If the cb.cachebust``System Setting
is enabled the asset will never be cached by the browser. If disabled, it will return the current version of the website obtained from the cb.site_ver System Setting
. Adding the site version to the URL will ensure that when changes pushed to production returning visiting aren't loading stale files from their browser cache.
Optional Settings¶
Placeholder¶
Cachebuster can set to a placeholder rather than returning a value. Simply pass the name of the placeholder you'd like to use as seen below.
[[$smartcache? &placeholder=`cbtime`]]
Appending Paramater¶
To append a URL parameter to the result use the param paramater as seen below.
[[$smartcache? ¶m=`?cb`]]
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn more