0

Is there anything like {{ time() }} or even more ideally {{ sha1sum('main.js') }} which I could use as a cachebust parameter in my theme templates?

Yes I'm aware of server side caching headers, but I don't have control of those.

mbarkhau
  • 8,190
  • 4
  • 30
  • 34

1 Answers1

0

The best I found so far is this {{ build_date_utc.strftime('%S%f') }} based on documentation I found here: http://www.mkdocs.org/user-guide/custom-themes/#template-variables

So now I can do this: <script src="/static/js/main.js?cb={{ build_date_utc.strftime('%S%f') }}">

Which invalidates the cached file much more than it should, but at least it solves the problem.

mbarkhau
  • 8,190
  • 4
  • 30
  • 34