Add surah/id_redirect

This commit is contained in:
0x1eef 2023-03-10 07:48:47 -03:00
parent 2dfadcb937
commit 9fef5122eb
4 changed files with 17 additions and 1 deletions

1
Rules
View file

@ -34,6 +34,7 @@ require_rules "rules/pages/surah/random", {locales:, surah_id_to_name:}
require_rules "rules/pages/surah/stream", {locales:, surah_id_to_name:}
require_rules "rules/pages/surah/index", {locales:}
require_rules "rules/pages/surah/redirect"
require_rules "rules/pages/surah/id_redirect", {locales:}
##
# Defaults

View file

@ -0,0 +1,15 @@
#!/usr/bin/env ruby
1.upto(114) do |id|
locales.each do |locale|
compile "/html/pages/surah/id_redirect.html.erb", rep: "redirect_id/#{id}" do
filter(:erb)
write("/#{locale}/#{id}/index.html")
end
end
end
compile "/js/pages/surah/id_redirect.ts" do
filter(:webpack)
write("/js/pages/surah/id_redirect.js")
end

View file

@ -7,6 +7,6 @@
<script class="surah-id-to-slug" type="application/json">
<%= File.read(File.join(Dir.getwd, "src", "slugs.json")) %>
</script>
<script src="/js/pages/redirect-to-surah-slug.js"></script>
<script src="/js/pages/surah/id_redirect.js"></script>
</body>
</html>