From 29993663d7d411e2a85a3f90d4804fd11d7b9275 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Fri, 21 Jun 2024 06:14:23 -0300 Subject: [PATCH] Add ability to cache-bust opengraph images --- nanoc/lib/mixin.rb | 2 +- nanoc/lib/mixin/opengraph.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nanoc/lib/mixin.rb b/nanoc/lib/mixin.rb index 7e2acc8..3b7608c 100644 --- a/nanoc/lib/mixin.rb +++ b/nanoc/lib/mixin.rb @@ -15,7 +15,7 @@ module Mixin end def revision - cmd("git rev-parse HEAD").stdout.strip + @rev ||= cmd("git", "rev-parse", "HEAD").stdout.strip end def build_dir diff --git a/nanoc/lib/mixin/opengraph.rb b/nanoc/lib/mixin/opengraph.rb index c23e757..e9fd834 100644 --- a/nanoc/lib/mixin/opengraph.rb +++ b/nanoc/lib/mixin/opengraph.rb @@ -12,7 +12,7 @@ module Mixin::OpenGraph {title: t(context.locale, "TheNobleQuran"), description: surah.name, url: "#{base_url}/#{context.locale}/#{surah.slug}/", - image: "#{base_url}/images/og/#{surah.id}.png"} + image: "#{base_url}/images/og/#{surah.id}.png?v=#{revision}"} when "redirect.html.erb", "surah-index.html.erb" {title: t(context.locale, "TheNobleQuran"), description: t(context.locale, "meta.index.description"),