al-quran.reflectslight.io/nanoc/lib/mixin/opengraph.rb
0x1eef d7cb6f62be images/opengraph/ -> images/og/
But most importantly, for src/og/0.png:

* resize to 512x512
* apply a white background
* similar to the format for og/1.png, og/2.png, etc
2024-05-02 07:32:11 -03:00

23 lines
852 B
Ruby

# frozen_string_literal: true
module Mixin::OpenGraph
def opengraph(context)
erb "partials/opengraph.html.erb", local_assigns(context)
end
def local_assigns(context)
case context.filename
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"}
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"}
end
end
end