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)
|
2023-10-07 08:26:43 +02:00
|
|
|
erb "partials/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
|
2023-10-05 00:49:26 +02:00
|
|
|
when "stream.html.erb"
|
2023-10-05 17:23:37 +02:00
|
|
|
{title: t(context.locale, "TheNobleQuran"),
|
2024-02-26 22:20:38 +01:00
|
|
|
description: t(context.locale, "meta.stream.description", surah_name: context.surah.name),
|
2023-10-05 17:23:37 +02:00
|
|
|
url: "https://al-quran.reflectslight.io/#{context.locale}/#{context.surah.slug}/",
|
|
|
|
image: "https://al-quran.reflectslight.io/images/opengraph/#{context.surah.id}.png"}
|
2023-11-12 21:09:57 +01:00
|
|
|
when "index.html.erb"
|
|
|
|
{title: t(context.locale, "TheNobleQuran"),
|
|
|
|
description: t(context.locale, "meta.index.description"),
|
|
|
|
url: "https://al-quran.reflectslight.io/#{context.locale}/",
|
|
|
|
image: "https://al-quran.reflectslight.io/images/opengraph/quran.png"}
|
2023-10-05 00:49:26 +02:00
|
|
|
end
|
|
|
|
end
|
2023-10-07 08:21:48 +02:00
|
|
|
end
|