Remove query for resource


#1

As topic. I want to ask is it possible to remove query in resources?

And also why ghost uses query? Is the resource changing frequently?


#2

@andrewyg could you maybe rephrase your question? What are “query” and “resource” referring to?


#3

From GTMetrix, it suggest me remove query following for like JS resources

Something like /asset/js/libraries.js


#4


#5

Yep


#6

OK, so you’re referring to how assets are loaded like this:

<link rel="stylesheet" href="/assets/built/screen.css?v=ab22cddc39">

The ?v= query param here is for cache-busting so that when you upload a theme change or switch themes your changes are actually seen by site visitors instead of a proxy/cache or your visitor’s browser cache keeping the old version of the file around for up to a year.

The GTMetrix recommendation is just that and in my opinion is out of date - I haven’t seen a cache which doesn’t cache files with query params for many years. Best advice is to not follow these sorts of tools blindly; find out why they are recommending certain changes and whether those changes come with downsides :wink:


#7

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.