From eeaf48bca82d0918e1335ae15e1877c5e2f1fdb6 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Wed, 15 May 2024 00:59:40 -0300 Subject: [PATCH] Add canonical and alternate link tags to all 'main' pages --- Rules | 2 +- nanoc/rules/random.rules | 2 +- nanoc/rules/redirect.rules | 2 +- src/html/main/random.html.erb | 10 ++++++++++ src/html/main/redirect.html.erb | 13 ++++++++++--- src/html/main/surah-index.html.erb | 10 +++------- src/html/main/surah-stream.html.erb | 10 +++------- 7 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Rules b/Rules index 9cfe7916b..6dab0ae6b 100644 --- a/Rules +++ b/Rules @@ -60,7 +60,7 @@ passthrough "/json/durations/*/*.json" ## # require rules require_rules "nanoc/rules/assets" -require_rules "nanoc/rules/redirect" +require_rules "nanoc/rules/redirect", {locales:} require_rules "nanoc/rules/random", {locales:} require_rules "nanoc/rules/stream", {locales:, tdata:, name_by_id:} require_rules "nanoc/rules/index", {locales:, tdata:} diff --git a/nanoc/rules/random.rules b/nanoc/rules/random.rules index 1f7d8a8c8..dfef61a74 100644 --- a/nanoc/rules/random.rules +++ b/nanoc/rules/random.rules @@ -8,7 +8,7 @@ locales.each do |locale| compile "/html/main/random.html.erb", rep: "random/#{locale}" do context = Ryo.from({locale:}) - filter(:erb, locals: {context:}) + filter(:erb, locals: {locale:, locales:, context:}) filter(:tidy) write("/#{locale}/random/index.html") end diff --git a/nanoc/rules/redirect.rules b/nanoc/rules/redirect.rules index ae2161ef3..7cdf28dc9 100644 --- a/nanoc/rules/redirect.rules +++ b/nanoc/rules/redirect.rules @@ -6,8 +6,8 @@ # to the surah index for a given locale (eg / -> /en/) compile "/html/main/redirect.html.erb" do + filter(:erb, locals: {locales:}) filter(:tidy) - filter(:erb) write("/index.html") end diff --git a/src/html/main/random.html.erb b/src/html/main/random.html.erb index 3280cf21e..cad71847b 100644 --- a/src/html/main/random.html.erb +++ b/src/html/main/random.html.erb @@ -2,6 +2,16 @@ <%= t(context.locale, "TheNobleQuran") %> + + <% locales.each do |locale| %> + + <% end %> <%= erb("_favicon.html.erb") %> diff --git a/src/html/main/redirect.html.erb b/src/html/main/redirect.html.erb index e7c35e3c2..1d9dd78af 100644 --- a/src/html/main/redirect.html.erb +++ b/src/html/main/redirect.html.erb @@ -2,9 +2,16 @@ <%= t("en", "TheNobleQuran") %> - - - + + <% locales.each do |locale| %> + + <% end %> <%= erb("_favicon.html.erb") %> diff --git a/src/html/main/surah-index.html.erb b/src/html/main/surah-index.html.erb index a382b2eed..400e1e064 100644 --- a/src/html/main/surah-index.html.erb +++ b/src/html/main/surah-index.html.erb @@ -8,16 +8,12 @@ <% locales.each do |locale| %> - + <% end %> <%= erb("_favicon.html.erb") %> <%= opengraph(context) %> diff --git a/src/html/main/surah-stream.html.erb b/src/html/main/surah-stream.html.erb index 32397c9c1..91e2e9cbd 100644 --- a/src/html/main/surah-stream.html.erb +++ b/src/html/main/surah-stream.html.erb @@ -8,16 +8,12 @@ '> <% locales.each do |locale| %> - + <% end %> <%= erb("_favicon.html.erb") %> <%= opengraph(context) %>