Skip to content

Commit

Permalink
Fix opengraph bug where if no images no preview, now use preview imag…
Browse files Browse the repository at this point in the history
…e of video
  • Loading branch information
cguess committed Sep 19, 2024
1 parent 1bdcc18 commit 6354635
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/public_access/media_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ def show
@archive_item = ArchiveItem.find_by(public_id: params[:public_id])
description = @archive_item.normalized_attrs_for_views[:archive_item_caption].present? ? "“#{@archive_item.normalized_attrs_for_views[:archive_item_caption]}”" : "(uncaptioned media)"
images = @archive_item.images.map { |image| image.image.download_url }
videos = @archive_item.videos.map { |video| video.video_derivatives[:preview].download_url }
images.concat @archive_item.videos.map { |video| video.video_derivatives[:preview].download_url } # Add videos as images since that's fine for previews too'
videos = @archive_item.videos.map { |video| video.video.download_url }

@page_metadata = { title: "Archive", description: description, images: images, videos: videos }
end
end

0 comments on commit 6354635

Please sign in to comment.