Skip to content

Commit

Permalink
feat: add VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesrocket committed Oct 19, 2024
1 parent b0a3a3f commit c14edb7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.19.0
3 changes: 1 addition & 2 deletions static/sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const broadcast = new BroadcastChannel('sw-channel');
const version = new URL(location).searchParams.get("version");
const cacheName = "v13-" + version;
const cacheName = new URL(location).searchParams.get("version");;
const cacheList = [
"/",
"/offline/",
Expand Down
5 changes: 4 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
{%- set tags = get_taxonomy(kind="tags") %}
{%- set active_path = current_path | default(value="none") %}
{%- set hash = "NA" %}
{%- set theme_version = load_data(path="./themes/halve-z/VERSION", required=false) %}
{%- set site_version = load_data(path="./VERSION", required=false) %}
{%- set version = theme_version | default(value=site_version) %}

{%- if config.extra.footer.hash or config.extra.manifest %}
{%- set head_branch = load_data(path=".git/HEAD") | replace(from="ref: ", to="") %}
Expand Down Expand Up @@ -127,7 +130,7 @@ <h1 class="section-title">{%- block page_title %}{% if page.title %}{{ page.titl
{% endif %}
{% endif %}
<span id="precache-payload">/notifications.js /sw.js?version={{ get_hash(path='/sw.js', sha_type=512, base64=false) | safe }} /sw-load.js?v={{get_hash(path='/sw-load.js', sha_type=512, base64=false) | safe }}&version={{ hash | truncate(length=10, end="") }} /fireball.gif?v={{ get_hash(path='/fireball.gif', sha_type=512, base64=false) }} /favicon.ico?v={{ get_hash(path='/favicon.ico', sha_type=512, base64=false) }} /favicon-16x16.png?v={{ get_hash(path='/favicon-16x16.png', sha_type=512, base64=false) }} /favicon-32x32.png?v={{ get_hash(path='/favicon-32x32.png', sha_type=512, base64=false) }} /icon-192x192.png?v={{ get_hash(path='/icon-192x192.png', sha_type=512, base64=false) }} /icon-512x512.png?v={{ get_hash(path='/icon-512x512.png', sha_type=512, base64=false) }} /apple-touch-icon.png?v={{ get_hash(path='/apple-touch-icon.png', sha_type=512, base64=false) }} /main.css?v={{ get_hash(path='/main.css', sha_type=512, base64=false) }} /nerd-fonts.css?v={{ get_hash(path='/nerd-fonts.css', sha_type=512, base64=false) }} /unstyle.css?v={{ get_hash(path='/unstyle.css', sha_type=512, base64=false) }} /langs.css?v={{ get_hash(path='/langs.css', sha_type=512, base64=false) }} /syntax-theme-light.css?v={{ get_hash(path='/syntax-theme-light.css', sha_type=512, base64=false) }} /syntax-theme-dark.css?v={{ get_hash(path='/syntax-theme-dark.css', sha_type=512, base64=false) }} /sw-style.css?v={{ get_hash(path="/sw-style.css", sha_type=512, base64=false) }} {% if posts_config.paginate_by %}{% for i in range(start=2, end=posts_page_count + 1) %}{{ "/posts/page/" ~ i ~ "/" | safe }} {% endfor %}{% endif %}{% if config.taxonomies %}{% for taxonomy in config.taxonomies %}{% set inner_taxonomy = get_taxonomy(kind=taxonomy.name) %}{{ "/" ~ taxonomy.name ~ "/" | safe }} {% for term in inner_taxonomy.items %}{{ term.path | safe }} {% endfor %}{% endfor %}{% endif %}{% if posts.pages %}{% for post in posts.pages %}{{ post.path | safe }} {% if post.assets %}{% for asset in post.assets %}{{ asset ~ "?v=" ~ get_hash(path=asset, sha_type=512, base64=false) | safe }} {% endfor %}{%endif%}{% endfor %}{% endif %}{% for link in config.extra.menu.links %}{% if link.url is starting_with("@") %}{{ get_url(path=link.url, trailing_slash=true) | safe }}{% else %}{{ link.url | safe }}{% endif %} {% endfor %}{% if config.extra.footer.enabled %}{% for link in config.extra.footer.links %}{% if link.name == "posts" %}{% continue %}{% endif %}{% if link.url is starting_with("@") %}{{ get_url(path=link.url, trailing_slash=true) | safe }}{% else %}{{ link.url | safe }}{% endif %} {% endfor %}{% endif %}{% if config.extra.menu.posts == true %}{{ "/posts/" | safe }} {% endif %}{% for link in config.extra.images.categories %}{% if link.image is not matching("^http[s]?://") %}{{ link.image ~ "?v=" ~ get_hash(path=link.image, sha_type=512, base64=false) | safe }} {% endif %}{% endfor %}{% if config.extra.images.home is not matching("^http[s]?://") %}{{ config.extra.images.home ~ "?v=" ~ get_hash(path=config.extra.images.home, sha_type=512, base64=false) | safe }} {% endif %}{% if config.extra.images.post_list is not matching("^http[s]?://") %}{{ config.extra.images.post_list ~ "?v=" ~ get_hash(path=config.extra.images.post_list, sha_type=512, base64=false) | safe }} {% endif %}{% if config.extra.images.default_post is not matching("^http[s]?://") %}{{ config.extra.images.default_post ~ "?v=" ~ get_hash(path=config.extra.images.default_post, sha_type=512, base64=false) | safe }}{% endif %} {{ "/" ~ config.extra.logo ~ "?v=" ~ get_hash(path=config.extra.logo, sha_type=512, base64=false) | safe }} {% if config.extra.home.glitch %}{{ '/glitch.css' ~ "?v=" ~ get_hash(path='/glitch.css', sha_type=512, base64=false) | safe }} {% endif %}{% if config.generate_sitemap %}{{ "/sitemap.xml" | safe }} {% endif %}{% if config.build_search_index == true %}{{ '/search.js' ~ "?v=" ~ get_hash(path='/search.js', sha_type=512, base64=false) | safe }} {{ '/elasticlunr.min.js' ~ "?v=" ~ get_hash(path='/elasticlunr.min.js', sha_type=512, base64=false) | safe }} {{ '/search_index.' ~ lang ~ '.json' ~ "?v=" ~ get_hash(path='/search_index.' ~ lang ~ '.json', sha_type=512, base64=false) | safe }}{% endif %}"></span>
<script type="module" integrity="sha512-{{ get_hash(path='sw-load.js', sha_type=512, base64=true) | safe }}" src="{{ '/sw-load.js?v=' ~ get_hash(path='/sw-load.js', sha_type=512, base64=false) | safe }}&version={{ hash | truncate(length=10, end="") }}"></script>
<script type="module" integrity="sha512-{{ get_hash(path='sw-load.js', sha_type=512, base64=true) | safe }}" src="{{ '/sw-load.js?v=' ~ get_hash(path='/sw-load.js', sha_type=512, base64=false) | safe }}&version={{ version | safe }}"></script>
{%- endif %}
</body>
</html>

0 comments on commit c14edb7

Please sign in to comment.