al-quran.reflectslight.io/nanoc/lib/mixin/opengraph.rb
0x1eef fea1d737f2 Add server.base_url, audio.base_url
With this change the website can be hosted on
any domain (up to being entirely independent of
al-quran.reflectslight.io) by configuring a
couple of variables.
2024-06-02 03:11:48 -03:00

28 lines
972 B
Ruby

# frozen_string_literal: true
module Mixin::OpenGraph
def opengraph(context)
erb "_opengraph.html.erb", local_assigns(context)
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"
{title: t(context.locale, "TheNobleQuran"),
description: t(context.locale, "meta.index.description"),
url: "#{base_url}/#{context.locale}/",
image: "#{base_url}/images/og/0.png"}
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"}
end
end
end