diff --git a/_includes/audio.html b/_includes/audio.html index 14c7801..277addc 100644 --- a/_includes/audio.html +++ b/_includes/audio.html @@ -1,7 +1,7 @@ {% if site.imagemagick.enabled %} {% for i in site.imagemagick.widths -%} - {% endfor -%} {% endif %} - - {%- if include.caption -%}{{ include.caption }}{%- endif %} diff --git a/_includes/head.html b/_includes/head.html index e717c18..19cf873 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -27,13 +27,12 @@ {% elsif site.icon != blank %} {% endif %} - + {% if site.enable_darkmode %} - - - + + {% endif %} diff --git a/_includes/scripts/misc.html b/_includes/scripts/misc.html index ddd6ee8..725a4c3 100644 --- a/_includes/scripts/misc.html +++ b/_includes/scripts/misc.html @@ -20,6 +20,6 @@ - - - + + + diff --git a/_includes/video.html b/_includes/video.html index e56e054..8e889cd 100644 --- a/_includes/video.html +++ b/_includes/video.html @@ -5,7 +5,7 @@ {% if extension == "mp4" or extension == "webm" or extension == "ogg" %} - {% if site.title == "blank" -%}{{ site.first_name }} {{ site.middle_name }} {{ site.last_name }}{%- else -%}{{ site.title }}{%- endif %} + {% if site.title == "blank" -%}{{ site.first_name }} {{ site.middle_name }} {{ site.last_name }}{%- else -%}{{ site.title }}{%- endif %} {{ page.subtitle }} @@ -26,7 +26,8 @@ layout: default {% include figure.html path=profile_image_path class=profile_image_class - alt=page.profile.image -%} + alt=page.profile.image + cache_bust=true -%} {% endif -%} {%- if page.profile.address %} diff --git a/_plugins/cache-bust.rb b/_plugins/cache-bust.rb new file mode 100644 index 0000000..f7efb23 --- /dev/null +++ b/_plugins/cache-bust.rb @@ -0,0 +1,51 @@ +# based on https://distresssignal.org/busting-css-cache-with-jekyll-md5-hash +# https://gist.github.com/BryanSchuetz/2ee8c115096d7dd98f294362f6a667db +module Jekyll + module CacheBust + class CacheDigester + require 'digest/md5' + require 'pathname' + + attr_accessor :file_name, :directory + + def initialize(file_name:, directory: nil) + self.file_name = file_name + self.directory = directory + end + + def digest! + [file_name, '?', Digest::MD5.hexdigest(file_contents)].join + end + + private + + def directory_files_content + target_path = File.join(directory, '**', '*') + Dir[target_path].map{|f| File.read(f) unless File.directory?(f) }.join + end + + def file_content + local_file_name = file_name.slice((file_name.index('assets/')..-1)) + File.read(local_file_name) + end + + def file_contents + is_directory? ? file_content : directory_files_content + end + + def is_directory? + directory.nil? + end + end + + def bust_file_cache(file_name) + CacheDigester.new(file_name: file_name, directory: nil).digest! + end + + def bust_css_cache(file_name) + CacheDigester.new(file_name: file_name, directory: 'assets/_sass').digest! + end + end +end + +Liquid::Template.register_filter(Jekyll::CacheBust) \ No newline at end of file
{{ page.subtitle }}