Add 'revision' meta tag

See https://github.com/krallin/meta-revision
This commit is contained in:
0x1eef 2024-05-25 00:53:15 -03:00
parent c234873725
commit 1673fd2cf4
8 changed files with 16 additions and 3 deletions

View file

@ -20,3 +20,4 @@ gem "ryo.rb"
gem "standard", "~> 1.24"
gem "paint", "~> 2.3"
gem "listen", "~> 3.0"
gem "test-cmd.rb"

View file

@ -137,6 +137,7 @@ GEM
rubocop-performance (~> 1.20.2)
stringio (3.1.0)
strscan (3.1.0)
test-cmd.rb (0.11.1)
tty-color (0.6.0)
tty-command (0.10.1)
pastel (~> 0.8)
@ -161,6 +162,7 @@ DEPENDENCIES
sass (~> 3.7)
server.rb
standard (~> 1.24)
test-cmd.rb
BUNDLED WITH
2.5.9

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true
module Mixin
require "test-cmd"
require_relative "mixin/t"
require_relative "mixin/inline"
require_relative "mixin/erb"
@ -13,6 +14,10 @@ module Mixin
end
end
def revision
["v#{app_version}", " ", "(#{cmd("git rev-parse HEAD").stdout.strip})"].join
end
def build_dir
@build_dir ||= begin
nanoc = Ryo.from YAML.load_file(File.join(Dir.getwd, "nanoc.yaml"))

View file

@ -0,0 +1 @@
<meta name="revision" content="<%= revision %>">

View file

@ -2,6 +2,7 @@
<html lang="<%= context.locale %>">
<head>
<title><%= t(context.locale, "TheNobleQuran") %></title>
<%= erb("_revision.html.erb") %>
<link
rel="canonical"
href="https://al-quran.reflectslight.io/<%= locale %>/random/"

View file

@ -2,6 +2,8 @@
<html lang="en">
<head>
<title><%= t("en", "TheNobleQuran") %></title>
<%= erb("_revision.html.erb") %>
<%= opengraph(Ryo(filename: "redirect.html.erb", locale: "en")) %>
<link
rel="canonical"
href="https://al-quran.reflectslight.io/en/"
@ -13,7 +15,6 @@
hreflang="<%= locale %>" />
<% end %>
<%= erb("_favicon.html.erb") %>
<%= opengraph(Ryo(filename: "redirect.html.erb", locale: "en")) %>
</head>
<body>
<script src="/js/main/redirect.js"></script>

View file

@ -6,6 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta charset="UTF-8">
<meta name="description" content="<%= t(locale, 'meta.index.description') %>">
<%= erb("_revision.html.erb") %>
<%= opengraph(context) %>
<link
rel="canonical"
href="https://al-quran.reflectslight.io/<%= locale %>/"
@ -16,7 +18,6 @@
hreflang="<%= locale %>" />
<% end %>
<%= erb("_favicon.html.erb") %>
<%= opengraph(context) %>
</head>
<body>
<div class="postman loader">

View file

@ -6,6 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<meta name="description" content='<%= t(locale, 'meta.stream.description', {surah_name: surah.name}) %>'>
<%= erb("_revision.html.erb") %>
<%= opengraph(context) %>
<link
rel="canonical"
href="https://al-quran.reflectslight.io/<%= locale %>/<%= surah.slug %>/"
@ -16,7 +18,6 @@
hreflang="<%= locale %>" />
<% end %>
<%= erb("_favicon.html.erb") %>
<%= opengraph(context) %>
</head>
<body>
<div class="postman loader">