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

29 lines
972 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 "_opengraph.html.erb", local_assigns(context)
2023-10-05 00:49:26 +02:00
end
def local_assigns(context)
case context.filename
when "surah-stream.html.erb"
surah = context.surah
{title: t(context.locale, "TheNobleQuran"),
description: surah.name,
url: "#{base_url}/#{context.locale}/#{surah.slug}/",
image: "#{base_url}/images/og/#{surah.id}.png"}
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"),
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"),
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