You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when static assets are linked to a MyST site build, their URL gets generated with a hash that is part of the filename. This is done to ensure that the cache is busted if the file is updated.
For example, using {download}`myfile.png` results in a filename like mysite.org/build/myfile-c7e3595ff6c09f5cc22cc52b8177cd4c.png)
The problem with this is that if you want to directly link to a static asset elsewhere, the link will be invalidated as soon as the MyST site is rebuilt, because the hash is included in the filename itself.
It would be useful if the URL for static assets was persistent as long as the user didn't change the filename, so that external links to them remained valid.
Potential solution: cache busting
One option is to use a query parameter to bust caches, rather than putting the hash in the filename.
The hash becomes part of a "query" parameter. You can thus still link directly to the file (mysite.org/build/myfile.png) and links on the MyST site will include the hash via the query parameter so you'll cache-bust as expected.
Currently when static assets are linked to a MyST site build, their URL gets generated with a hash that is part of the filename. This is done to ensure that the cache is busted if the file is updated.
For example, using
{download}`myfile.png`
results in a filename likemysite.org/build/myfile-c7e3595ff6c09f5cc22cc52b8177cd4c.png)
The problem with this is that if you want to directly link to a static asset elsewhere, the link will be invalidated as soon as the MyST site is rebuilt, because the hash is included in the filename itself.
It would be useful if the URL for static assets was persistent as long as the user didn't change the filename, so that external links to them remained valid.
Potential solution: cache busting
One option is to use a query parameter to bust caches, rather than putting the hash in the filename.
Essentially you'd move the hash from this:
to this:
The hash becomes part of a "query" parameter. You can thus still link directly to the file (
mysite.org/build/myfile.png
) and links on the MyST site will include the hash via the query parameter so you'll cache-bust as expected.References
The text was updated successfully, but these errors were encountered: