Add canonical and alternate link tags to all 'main' pages
This commit is contained in:
parent
fe32825e2b
commit
eeaf48bca8
7 changed files with 29 additions and 20 deletions
2
Rules
2
Rules
|
@ -60,7 +60,7 @@ passthrough "/json/durations/*/*.json"
|
||||||
##
|
##
|
||||||
# require rules
|
# require rules
|
||||||
require_rules "nanoc/rules/assets"
|
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/random", {locales:}
|
||||||
require_rules "nanoc/rules/stream", {locales:, tdata:, name_by_id:}
|
require_rules "nanoc/rules/stream", {locales:, tdata:, name_by_id:}
|
||||||
require_rules "nanoc/rules/index", {locales:, tdata:}
|
require_rules "nanoc/rules/index", {locales:, tdata:}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
locales.each do |locale|
|
locales.each do |locale|
|
||||||
compile "/html/main/random.html.erb", rep: "random/#{locale}" do
|
compile "/html/main/random.html.erb", rep: "random/#{locale}" do
|
||||||
context = Ryo.from({locale:})
|
context = Ryo.from({locale:})
|
||||||
filter(:erb, locals: {context:})
|
filter(:erb, locals: {locale:, locales:, context:})
|
||||||
filter(:tidy)
|
filter(:tidy)
|
||||||
write("/#{locale}/random/index.html")
|
write("/#{locale}/random/index.html")
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
# to the surah index for a given locale (eg / -> /en/)
|
# to the surah index for a given locale (eg / -> /en/)
|
||||||
|
|
||||||
compile "/html/main/redirect.html.erb" do
|
compile "/html/main/redirect.html.erb" do
|
||||||
|
filter(:erb, locals: {locales:})
|
||||||
filter(:tidy)
|
filter(:tidy)
|
||||||
filter(:erb)
|
|
||||||
write("/index.html")
|
write("/index.html")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,16 @@
|
||||||
<html lang="<%= context.locale %>">
|
<html lang="<%= context.locale %>">
|
||||||
<head>
|
<head>
|
||||||
<title><%= t(context.locale, "TheNobleQuran") %></title>
|
<title><%= t(context.locale, "TheNobleQuran") %></title>
|
||||||
|
<link
|
||||||
|
rel="canonical"
|
||||||
|
href="https://al-quran.reflectslight.io/<%= locale %>/random/"
|
||||||
|
/>
|
||||||
|
<% locales.each do |locale| %>
|
||||||
|
<link
|
||||||
|
rel="alternate"
|
||||||
|
href="https://al-quran.reflectslight.io/<%= locale %>/random/"
|
||||||
|
hreflang="<%= locale %>" />
|
||||||
|
<% end %>
|
||||||
<%= erb("_favicon.html.erb") %>
|
<%= erb("_favicon.html.erb") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -2,9 +2,16 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title><%= t("en", "TheNobleQuran") %></title>
|
<title><%= t("en", "TheNobleQuran") %></title>
|
||||||
<link rel="canonical" href="https://al-quran.reflectslight.io/en/">
|
<link
|
||||||
<link rel="alternate" hreflang="ar" href="https://al-quran.reflectslight.io/ar/">
|
rel="canonical"
|
||||||
<link rel="alternate" hreflang="en" href="https://al-quran.reflectslight.io/en/">
|
href="https://al-quran.reflectslight.io/en/"
|
||||||
|
/>
|
||||||
|
<% locales.each do |locale| %>
|
||||||
|
<link
|
||||||
|
rel="alternate"
|
||||||
|
href="https://al-quran.reflectslight.io/<%= locale %>/"
|
||||||
|
hreflang="<%= locale %>" />
|
||||||
|
<% end %>
|
||||||
<%= erb("_favicon.html.erb") %>
|
<%= erb("_favicon.html.erb") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -8,16 +8,12 @@
|
||||||
<meta name="description" content="<%= t(locale, 'meta.index.description') %>">
|
<meta name="description" content="<%= t(locale, 'meta.index.description') %>">
|
||||||
<link
|
<link
|
||||||
rel="canonical"
|
rel="canonical"
|
||||||
hreflang="<%= locale %>"
|
|
||||||
href="https://al-quran.reflectslight.io/<%= locale %>/"
|
href="https://al-quran.reflectslight.io/<%= locale %>/"
|
||||||
/>
|
/>
|
||||||
<% locales.each do |locale| %>
|
<% locales.each do |locale| %>
|
||||||
<link
|
<link rel="alternate"
|
||||||
rel="alternate"
|
href="https://al-quran.reflectslight.io/<%= locale %>/"
|
||||||
type="text/html"
|
hreflang="<%= locale %>" />
|
||||||
hreflang="<%= locale %>"
|
|
||||||
href="https://al-quran.reflectslight.io/<%= locale %>/"
|
|
||||||
/>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= erb("_favicon.html.erb") %>
|
<%= erb("_favicon.html.erb") %>
|
||||||
<%= opengraph(context) %>
|
<%= opengraph(context) %>
|
||||||
|
|
|
@ -8,16 +8,12 @@
|
||||||
<meta name="description" content='<%= t(locale, 'meta.stream.description', {surah_name: surah.name}) %>'>
|
<meta name="description" content='<%= t(locale, 'meta.stream.description', {surah_name: surah.name}) %>'>
|
||||||
<link
|
<link
|
||||||
rel="canonical"
|
rel="canonical"
|
||||||
hreflang="<%= locale %>"
|
|
||||||
href="https://al-quran.reflectslight.io/<%= locale %>/<%= surah.slug %>/"
|
href="https://al-quran.reflectslight.io/<%= locale %>/<%= surah.slug %>/"
|
||||||
/>
|
/>
|
||||||
<% locales.each do |locale| %>
|
<% locales.each do |locale| %>
|
||||||
<link
|
<link rel="alternate"
|
||||||
rel="alternate"
|
href="https://al-quran.reflectslight.io/<%= locale %>/<%= surah.slug %>/"
|
||||||
type="text/html"
|
hreflang="<%= locale %>" />
|
||||||
hreflang="<%= locale %>"
|
|
||||||
href="https://al-quran.reflectslight.io/<%= locale %>/<%= surah.slug %>/"
|
|
||||||
/>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= erb("_favicon.html.erb") %>
|
<%= erb("_favicon.html.erb") %>
|
||||||
<%= opengraph(context) %>
|
<%= opengraph(context) %>
|
||||||
|
|
Loading…
Reference in a new issue