al-quran.reflectslight.io/nanoc/lib/mixin/opengraph.rb

24 lines
852 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2023-10-07 08:21:48 +02:00
module Mixin::OpenGraph
def opengraph(context)
erb "partials/opengraph.html.erb", local_assigns(context)
2023-10-05 00:49:26 +02:00
end
def local_assigns(context)
case context.filename
2023-10-05 00:49:26 +02:00
when "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"}
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/og/0.png"}
2023-10-05 00:49:26 +02:00
end
end
2023-10-07 08:21:48 +02:00
end