From 76acaf441208279355fb913afff06618c7d5dfbd Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 21 Oct 2023 13:31:37 -0400 Subject: Added OpenGraph link preview tags for quotes --- app/controllers/quotes_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/controllers/quotes_controller.rb') diff --git a/app/controllers/quotes_controller.rb b/app/controllers/quotes_controller.rb index cad7dfd..be931a0 100644 --- a/app/controllers/quotes_controller.rb +++ b/app/controllers/quotes_controller.rb @@ -50,6 +50,17 @@ class QuotesController < ApplicationController def show @quote = Quote.published.find(params[:id]) + set_meta_tags(og: { + title: "Quote \##{@quote.id}", + type: "article", + description: (@quote.content.length <= 300 ? @quote.content : @quote.content[0..299]), + url: quote_url(@quote, host: "www.fourisland.com"), + article: { + published_time: @quote.created_at.iso8601, + modified_time: @quote.updated_at.iso8601 + } + }) + respond_to do |format| format.html format.json { render :json => @quote } -- cgit 1.4.1