Show OG metadata for bookmarks
This commit is contained in:
30
app/views/bookmarks/metadata.rb
Normal file
30
app/views/bookmarks/metadata.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
require "ogpr"
|
||||
|
||||
module Adamantium
|
||||
module Views
|
||||
module Bookmarks
|
||||
class Metadata < View
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
config.layout = nil
|
||||
|
||||
expose :description do |og_data|
|
||||
og_data.description
|
||||
end
|
||||
|
||||
expose :title do |og_data|
|
||||
og_data.title
|
||||
end
|
||||
|
||||
expose :image do |og_data|
|
||||
og_data.image
|
||||
end
|
||||
|
||||
private_expose :og_data do |id:|
|
||||
url = post_repo.find!(id).url
|
||||
Ogpr.fetch(url)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user