Add cache buster

Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
This commit is contained in:
Miao Wang 2021-06-23 15:16:57 +08:00
parent 045ff5c292
commit 3e2e47a3d8
No known key found for this signature in database
GPG Key ID: B031E3CA7BFED96E
6 changed files with 40 additions and 19 deletions

View File

@ -9,20 +9,20 @@
<link rel="shortcut icon" href="/static/img/favicon.png">
<title>{% if page.mirrorid %} {{ page.mirrorid }} |{% elsif page.title %} {{ page.title }} |{% endif %}{% if include.cattitle %} {{ include.cattitle }} |{% endif %}{% if (page.title or include.cattitle) %}{{" "}}{% endif %}{{ site.title }}{% if site.brand %} | {{ site.brand }}{% endif %}</title>
{% unless include.nostyle %}
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/css/bootstrap-select.min.css">
<link rel="stylesheet" href="/static/css/font-awesome.min.css" >
<link rel="stylesheet" href="/static/css/style.css">
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/bootstrap-select.min.js"></script>
<link rel="stylesheet" href="/static/css/bootstrap.min.css?{{ site.data['hash'] }}">
<link rel="stylesheet" href="/static/css/bootstrap-select.min.css?{{ site.data['hash'] }}">
<link rel="stylesheet" href="/static/css/font-awesome.min.css?{{ site.data['hash'] }}" >
<link rel="stylesheet" href="/static/css/style.css?{{ site.data['hash'] }}">
<script src="/static/js/jquery.min.js?{{ site.data['hash'] }}"></script>
<script src="/static/js/bootstrap.min.js?{{ site.data['hash'] }}"></script>
<script src="/static/js/bootstrap-select.min.js?{{ site.data['hash'] }}"></script>
{% unless page.legacy %}
<script src="/static/js/vue.min.js"></script>
<script src="/static/js/timeago.min.js"></script>
<script src="/static/js/vue.min.js?{{ site.data['hash'] }}"></script>
<script src="/static/js/timeago.min.js?{{ site.data['hash'] }}"></script>
{% endunless %}
<script src="/static/js/markup.min.js"></script>
<script src="/static/js/webfont.js"></script>
<script src="/static/js/thuhidden.js"></script>
<script src="/static/js/markup.min.js?{{ site.data['hash'] }}"></script>
<script src="/static/js/webfont.js?{{ site.data['hash'] }}"></script>
<script src="/static/js/thuhidden.js?{{ site.data['hash'] }}"></script>
{% if page.legacy %}
<style>
.container {

View File

@ -52,7 +52,7 @@
{% include footer.html %}
</body>
<script src="/static/js/help.js"></script>
<script src="/static/js/help.js?{{ site.data['hash'] }}"></script>
</html>
<!--

View File

@ -209,8 +209,8 @@
{% raw %}
{% endraw %}
{% unless page.legacy or site.issue %}
<script src="/static/js/index.js"></script>
<script src="/static/js/browser-update.js"></script>
<script src="/static/js/index.js?{{ site.data['hash'] }}"></script>
<script src="/static/js/browser-update.js?{{ site.data['hash'] }}"></script>
{% endunless %}
</html>
<!--

View File

@ -0,0 +1,21 @@
# Jekyll plugin for generating Git hash
#
# Place this file in the _plugins directory and
# use {{ site.data['hash'] }} in your Liquid templates
#
# Author: Yegor Bugayenko <yegor@tpc2.com>
# Source: http://github.com/yegor256/jekyll-git-hash
#
# Distributed under the MIT license
# Copyright Yegor Bugayenko, 2014
module Jekyll
class GitHashGenerator < Generator
priority :high
safe true
def generate(site)
hash = %x( git rev-parse --short HEAD ).strip
site.data['hash'] = hash
end
end
end

View File

@ -13,8 +13,8 @@ permalink: /fancy-index/after.html
</body>
{% raw %}
{% endraw %}
<script src="/static/js/index.js"></script>
<script src="/static/js/browser-update.js"></script>
<script src="/static/js/index.js?{{ site.data['hash'] }}"></script>
<script src="/static/js/browser-update.js?{{ site.data['hash'] }}"></script>
{% raw %}
<script>
document.getElementById("list").setAttribute("class", "table");

View File

@ -144,8 +144,8 @@ permalink: /status/
{% endunless %}
</div><!--/status -->
{% include footer.html %}
<script src="/static/js/status.js"></script>
<script src="/static/js/index.js"></script>
<script src="/static/js/status.js?{{ site.data['hash'] }}"></script>
<script src="/static/js/index.js?{{ site.data['hash'] }}"></script>
</body>
</html>
<!--