Skip to content

Commit

Permalink
Add meta iamge from blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
takahashim committed Aug 28, 2023
1 parent 01166ec commit 69b42d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/views/decidim/blogs/posts/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
description: translated_attribute(post.body).truncate(Rails.application.config.default_blog_ogp_description_limit),
url: post_url(post.id)
}) %>
<%
doc = Nokogiri::HTML(translated_attribute(post.body))
img = doc.css('img')&.first
add_decidim_meta_image_url(img['src']) if img
%>
<%
edit_link(
resource_locator(post).edit,
Expand Down

0 comments on commit 69b42d4

Please sign in to comment.