Merge pull request #86 from ReflectsLight/new_index

Redirect to the surah index from the root path
This commit is contained in:
Robert 2023-03-08 00:31:25 -03:00 committed by GitHub
commit 414ef6f703
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 5 deletions

View file

@ -4,11 +4,6 @@
# Contains rules that are related to RandomRedirect.html.erb
# in one way or another
compile "/html/RandomRedirect.html.erb" do
filter(:erb)
write("/index.html")
end
compile "/html/redirect-to-surah-slug.html.erb" do
filter(:erb)
1.upto(114) do |surahno|

View file

@ -4,6 +4,16 @@
# Contains rules that are related to TheSurahIndex in one
# way or another.
compile "/html/surah/index/redirect.html.erb" do
filter(:erb)
write("/index.html")
end
compile "/js/surah/index/redirect.ts" do
filter(:webpack)
write("/js/surah/index/redirect.js")
end
compile "/surahs.json" do
write "/surahs.json"
end

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<head>
<title></title>
</head>
<body>
<script src="/js/surah/index/redirect.js"></script>
</body>
</html>

View file

@ -0,0 +1,6 @@
import { Locale } from 'lib/Locale';
(function(window, location) {
const locale = Locale(window).fromBrowser();
location.replace(`/${locale}/`);
})(window, location);