Skip to content

Commit

Permalink
Merge pull request #503 from photonia-io/opengraph
Browse files Browse the repository at this point in the history
Add opengraph fields when displaying a photo
  • Loading branch information
janosrusiczki authored Apr 13, 2023
2 parents 6c45452 + 4d7c9e0 commit 14b028b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/views/layouts/_opengraph.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<meta property="og:title" content="<%= @photo.name %>"/>
<meta property="og:description" content="<%= @photo.description %>"/>
<meta property="og:image" content="<%= @photo.image_url(:large) %>"/>
<meta property="og:image:width" content="<%= @photo.image_derivatives[:large].width %>"/>
<meta property="og:image:height" content="<%= @photo.image_derivatives[:large].height %>"/>
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<head>
<title><%= (yield(:page_title) + " - " unless yield(:page_title).blank?).to_s + "Photonia" %></title>

<%= render partial: 'layouts/opengraph' if @photo %>

<%= vite_client_tag %>
<%= vite_javascript_tag 'application' %>

Expand Down

0 comments on commit 14b028b

Please sign in to comment.