src/html/*.html.erb => src/html/main/*.html.erb

This commit is contained in:
0x1eef 2024-05-15 00:20:40 -03:00
parent 8d44281079
commit fe32825e2b
11 changed files with 15 additions and 15 deletions

View file

@ -2,18 +2,18 @@
module Mixin::OpenGraph
def opengraph(context)
erb "partials/opengraph.html.erb", local_assigns(context)
erb "_opengraph.html.erb", local_assigns(context)
end
def local_assigns(context)
case context.filename
when "stream.html.erb"
when "surah-stream.html.erb"
surah = context.surah
{title: t(context.locale, "TheNobleQuran"),
description: t(context.locale, "meta.stream.description", surah_name: surah.name),
url: "https://al-quran.reflectslight.io/#{context.locale}/#{surah.slug}/",
image: "https://al-quran.reflectslight.io/images/og/#{surah.id}.png"}
when "index.html.erb"
when "surah-index.html.erb"
{title: t(context.locale, "TheNobleQuran"),
description: t(context.locale, "meta.index.description"),
url: "https://al-quran.reflectslight.io/#{context.locale}/",

View file

@ -6,8 +6,8 @@
# at /<locale>/
locales.each do |locale|
compile "/html/index.html.erb", rep: "/#{locale}/surah/index" do
context = Ryo.from(filename: "index.html.erb", locale:, locales:)
compile "/html/main/surah-index.html.erb", rep: "/#{locale}/surah/index" do
context = Ryo.from(filename: "surah-index.html.erb", locale:, locales:)
locals = {locale: context.locale, locales: context.locales, context:}
filter(:erb, {locals:})
filter(:tidy)

View file

@ -6,7 +6,7 @@
# random surah (eg /en/random/ -> /en/al-kahf/)
locales.each do |locale|
compile "/html/random.html.erb", rep: "random/#{locale}" do
compile "/html/main/random.html.erb", rep: "random/#{locale}" do
context = Ryo.from({locale:})
filter(:erb, locals: {context:})
filter(:tidy)

View file

@ -5,7 +5,7 @@
# Contains rules for a redirect from the root path
# to the surah index for a given locale (eg / -> /en/)
compile "/html/redirect.html.erb" do
compile "/html/main/redirect.html.erb" do
filter(:tidy)
filter(:erb)
write("/index.html")

View file

@ -17,7 +17,7 @@ Ryo.each(name_by_id) do |id, slug|
write_file = ->(locale, pathname:) do
name = tdata[locale].surahs.names[id.to_i - 1]
context = Ryo.from(
filename: "stream.html.erb",
filename: "surah-stream.html.erb",
locale:,
locales:,
surah: {id:, name:, slug:}
@ -31,10 +31,10 @@ Ryo.each(name_by_id) do |id, slug|
write "/#{locale}/#{pathname}/index.html"
end
locales.each do |locale|
compile "/html/stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
compile "/html/main/surah-stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
instance_exec(locale, pathname: slug, &write_file)
end
compile "/html/stream.html.erb", rep: "/#{locale}/#{id}/index.html" do
compile "/html/main/surah-stream.html.erb", rep: "/#{locale}/#{id}/index.html" do
instance_exec(locale, pathname: id, &write_file)
end
end

View file

@ -2,7 +2,7 @@
<html lang="<%= context.locale %>">
<head>
<title><%= t(context.locale, "TheNobleQuran") %></title>
<%= erb("partials/favicon.html.erb") %>
<%= erb("_favicon.html.erb") %>
</head>
<body>
<script src="/js/main/random.js"></script>

View file

@ -5,9 +5,9 @@
<link rel="canonical" href="https://al-quran.reflectslight.io/en/">
<link rel="alternate" hreflang="ar" href="https://al-quran.reflectslight.io/ar/">
<link rel="alternate" hreflang="en" href="https://al-quran.reflectslight.io/en/">
<%= erb("partials/favicon.html.erb") %>
<script src="/js/main/redirect.js"></script>
<%= erb("_favicon.html.erb") %>
</head>
<body>
<script src="/js/main/redirect.js"></script>
</body>
</html>

View file

@ -6,7 +6,6 @@
<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("partials/favicon.html.erb") %>
<link
rel="canonical"
hreflang="<%= locale %>"
@ -20,6 +19,7 @@
href="https://al-quran.reflectslight.io/<%= locale %>/"
/>
<% end %>
<%= erb("_favicon.html.erb") %>
<%= opengraph(context) %>
</head>
<body>

View file

@ -6,7 +6,6 @@
<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("partials/favicon.html.erb") %>
<link
rel="canonical"
hreflang="<%= locale %>"
@ -20,6 +19,7 @@
href="https://al-quran.reflectslight.io/<%= locale %>/<%= surah.slug %>/"
/>
<% end %>
<%= erb("_favicon.html.erb") %>
<%= opengraph(context) %>
</head>
<body>