Add opengraph

Fix #151
This commit is contained in:
0x1eef 2023-10-04 19:49:26 -03:00
parent 84c91974ed
commit dc23ed29bf
123 changed files with 46 additions and 7 deletions

2
.bundle/config Normal file
View file

@ -0,0 +1,2 @@
---
BUNDLE_PATH: ".localgems"

2
.gitignore vendored
View file

@ -1,7 +1,7 @@
build/
tmp/
node_modules/
.bundle/
.localgems/
*.log
.env
.idea

View file

@ -177,4 +177,4 @@ DEPENDENCIES
test-cmd.rb (~> 0.3)!
BUNDLED WITH
2.3.26
2.4.10

View file

@ -32,5 +32,12 @@ module Helper
)
)
end
def erb(partial, local_assigns = {})
erb = File.binread File.join(Dir.getwd, "src", "html", "partials", partial)
scope = binding
local_assigns.each { scope.local_variable_set(_1, _2) }
ERB.new(erb).result(scope)
end
end
use_helper Helper

View file

@ -0,0 +1,19 @@
use_helper Module.new {
require_relative "helper"
include Helper
def opengraph(locale, basename, options = {})
erb "opengraph.html.erb", local_assigns(locale, basename, options)
end
def local_assigns(locale, basename, options)
case basename
when "stream.html.erb"
surah_id = options[:surah_id]
{ title: t(locale, "TheNobleQuran"),
description: t(locale, "meta.stream.description"),
url: "https://al-quran.reflectslight.io/#{locale}/#{surah_id}/",
image: "https://al-quran.reflectslight.io/images/opengraph/#{surah_id}.png" }
end
end
}

View file

@ -23,3 +23,7 @@ end
compile "/favicon.png" do
write(item.identifier.to_s)
end
compile "/images/opengraph/*.png" do
write(item.identifier.to_s)
end

View file

@ -2,11 +2,12 @@
<html lang="<%= locale %>">
<head>
<title> <%= t(locale, "TheNobleQuran") %>: <%= surah_name %> </title>
<%= inline_css('/css/postman.css') %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<meta name="description" content="<%= t(locale, 'meta.stream.description', {surah_name:}) %>">
<meta name="description" content="<%= t(locale, 'meta.stream.description') %>">
<%= opengraph(locale, "stream.html.erb", {surah_id:}) %>
<link rel="icon" href="/favicon.png">
<%= inline_css('/css/postman.css') %>
</head>
<body>
<div class="postman loader">

View file

@ -0,0 +1,6 @@
<meta property="og:type" content="website"/>
<meta property="og:title" content="<%= title %>"/>
<meta property="og:description" content="<%= description %>"/>
<meta property="og:url" content="<%= url %>"/>
<meta property="og:image" content="<%= image %>"
<meta property="og:image:type" content="image/png"/>

View file

@ -7,7 +7,7 @@
"comma": ",",
"meta": {
"index": {"description": "Read and listen to The Noble Quran."},
"stream": {"description": "Read and listen to '%{surah_name}' from The Noble Quran."}
"stream": {"description": "Read and listen to The Noble Quran."}
},
"surahs": {
"names": [
@ -135,8 +135,8 @@
"ayah": "آية",
"comma": "،",
"meta": {
"index": {"description": "اقرأ واستمع إلى القرآن الكريم."},
"stream": {"description": "اقرأ واستمع إلى القرآن الكريم - '%{surah_name}'."}
"index": {"description": "اقرأ واستمع إلى القرآن الكريم"},
"stream": {"description": "اقرأ واستمع إلى القرآن الكريم"}
},
"surahs": {
"names": [

BIN
src/images/opengraph/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
src/images/opengraph/10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
src/images/opengraph/11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
src/images/opengraph/12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
src/images/opengraph/13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/images/opengraph/14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
src/images/opengraph/15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
src/images/opengraph/18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
src/images/opengraph/20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
src/images/opengraph/24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
src/images/opengraph/25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/images/opengraph/26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
src/images/opengraph/27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/28.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/29.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/31.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/33.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
src/images/opengraph/34.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
src/images/opengraph/36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src/images/opengraph/37.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/38.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
src/images/opengraph/39.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
src/images/opengraph/41.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src/images/opengraph/42.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/43.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
src/images/opengraph/44.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/45.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/images/opengraph/46.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/47.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/49.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/50.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
src/images/opengraph/51.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/52.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/53.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
src/images/opengraph/54.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/images/opengraph/55.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
src/images/opengraph/56.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/57.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src/images/opengraph/58.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/59.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/images/opengraph/60.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/61.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/62.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
src/images/opengraph/63.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/65.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/66.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/images/opengraph/67.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/images/opengraph/68.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src/images/opengraph/69.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
src/images/opengraph/70.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
src/images/opengraph/71.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
src/images/opengraph/72.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/73.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
src/images/opengraph/74.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
src/images/opengraph/75.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src/images/opengraph/76.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/images/opengraph/77.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
src/images/opengraph/78.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Some files were not shown because too many files have changed in this diff Show more