From c2cfdb29e5530c46bffda39204adb29a247b6f52 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 12 May 2025 15:26:46 -0400 Subject: Added opengraph info for stream pages --- app/controllers/streams_controller.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app') diff --git a/app/controllers/streams_controller.rb b/app/controllers/streams_controller.rb index aa81ab1..ec4cee8 100644 --- a/app/controllers/streams_controller.rb +++ b/app/controllers/streams_controller.rb @@ -1,4 +1,5 @@ class StreamsController < ApplicationController + include ApplicationHelper def index @streams = Stream.order(latest_post_at: :desc).paginate(page: params[:page], per_page: 10) @@ -7,6 +8,19 @@ class StreamsController < ApplicationController def show @stream = Stream.find_by_slug(params[:slug]) @updates = @stream.updates.paginate(page: params[:page], per_page: 10) + + body = stripped_markdown(@stream.body) + + set_meta_tags(og: { + title: @stream.title, + type: "article", + description: body[0, 299], + url: stream_url(@stream, host: "www.fourisland.com"), + article: { + published_time: @stream.created_at.iso8601, + modified_time: @stream.latest_post_at.iso8601 + } + }) end end -- cgit 1.4.1