2023-10-05 17:23:37 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-07 08:21:48 +02:00
|
|
|
module Mixin::OpenGraph
|
2023-10-05 16:51:39 +02:00
|
|
|
def opengraph(context)
|
2024-05-15 05:20:40 +02:00
|
|
|
erb "_opengraph.html.erb", local_assigns(context)
|
2023-10-05 00:49:26 +02:00
|
|
|
end
|
|
|
|
|
2023-10-05 16:51:39 +02:00
|
|
|
def local_assigns(context)
|
|
|
|
case context.filename
|
2024-05-15 05:20:40 +02:00
|
|
|
when "surah-stream.html.erb"
|
2024-05-01 05:00:45 +02:00
|
|
|
surah = context.surah
|
2023-10-05 17:23:37 +02:00
|
|
|
{title: t(context.locale, "TheNobleQuran"),
|
2024-05-19 23:01:16 +02:00
|
|
|
description: surah.name,
|
2024-06-02 08:07:45 +02:00
|
|
|
url: "#{base_url}/#{context.locale}/#{surah.slug}/",
|
2024-06-21 11:14:23 +02:00
|
|
|
image: "#{base_url}/images/og/#{surah.id}.png?v=#{revision}"}
|
2024-05-16 22:00:53 +02:00
|
|
|
when "redirect.html.erb", "surah-index.html.erb"
|
2023-11-12 21:09:57 +01:00
|
|
|
{title: t(context.locale, "TheNobleQuran"),
|
|
|
|
description: t(context.locale, "meta.index.description"),
|
2024-06-02 08:07:45 +02:00
|
|
|
url: "#{base_url}/#{context.locale}/",
|
|
|
|
image: "#{base_url}/images/og/0.png"}
|
2024-05-26 04:12:42 +02:00
|
|
|
when "random.html.erb"
|
|
|
|
{title: t(context.locale, "TheNobleQuran"),
|
|
|
|
description: t(context.locale, "meta.random.description"),
|
2024-06-02 08:07:45 +02:00
|
|
|
url: "#{base_url}/#{context.locale}/random/",
|
|
|
|
image: "#{base_url}/images/og/0.png"}
|
2023-10-05 00:49:26 +02:00
|
|
|
end
|
|
|
|
end
|
2023-10-07 08:21:48 +02:00
|
|
|
end
|