Rules: update

This commit is contained in:
0x1eef 2022-11-05 20:48:59 -03:00
parent c99982cb86
commit 817b1305ac
2 changed files with 6 additions and 2 deletions

8
Rules
View file

@ -11,18 +11,21 @@ SURAH_ID_TO_SLUG = Ryo.from(
## ##
# Root path (/) # Root path (/)
compile "/index.html" do # Redirects to a random surah no
compile "/html/random_redirect.html" do
write("/index.html") write("/index.html")
end end
## ##
# /<locale>/<surahno>/surah.json # /<locale>/<surahno>/surah.json
# Provides the JSON for a given surah no
1.upto(114) do |surahno| 1.upto(114) do |surahno|
LOCALES.each { passthrough "/#{_1}/#{surahno}/surah.json" } LOCALES.each { passthrough "/#{_1}/#{surahno}/surah.json" }
end end
## ##
# /<locale>/<surahno>/index.html # /<locale>/<surahno>/index.html
# Redirects to a slug URL (eg /en/al-fatihah/)
compile "/html/slug_redirect.html.erb" do compile "/html/slug_redirect.html.erb" do
filter :erb filter :erb
1.upto(114) do |surahno| 1.upto(114) do |surahno|
@ -32,9 +35,10 @@ end
## ##
# /<locale>/surah_slug>/index.html # /<locale>/surah_slug>/index.html
# For reading a given surah
Ryo.each(SURAH_ID_TO_SLUG) do |surah_id, slug| Ryo.each(SURAH_ID_TO_SLUG) do |surah_id, slug|
LOCALES.each do |locale| LOCALES.each do |locale|
compile "/html/surah.html", rep: "#{locale}/#{slug}" do compile "/html/surah.html.erb", rep: "/#{locale}/#{slug}/index.html" do
filter :erb, locals: {locale: locale, surah_id: surah_id} filter :erb, locals: {locale: locale, surah_id: surah_id}
write "/#{locale}/#{slug}/index.html" write "/#{locale}/#{slug}/index.html"
end end