about summary refs log tree commit diff stats
path: root/app/controllers/quotes_controller.rb
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-21 13:31:37 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-21 13:31:37 -0400
commit76acaf441208279355fb913afff06618c7d5dfbd (patch)
treebede648498400bedb78d1815c0b17e8d0f25b301 /app/controllers/quotes_controller.rb
parent0d50b1f18993827cb6862efeedea528b64fad164 (diff)
downloadthoughts-76acaf441208279355fb913afff06618c7d5dfbd.tar.gz
thoughts-76acaf441208279355fb913afff06618c7d5dfbd.tar.bz2
thoughts-76acaf441208279355fb913afff06618c7d5dfbd.zip
Added OpenGraph link preview tags for quotes
Diffstat (limited to 'app/controllers/quotes_controller.rb')
-rw-r--r--app/controllers/quotes_controller.rb11
1 files changed, 11 insertions, 0 deletions
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
50 def show 50 def show
51 @quote = Quote.published.find(params[:id]) 51 @quote = Quote.published.find(params[:id])
52 52
53 set_meta_tags(og: {
54 title: "Quote \##{@quote.id}",
55 type: "article",
56 description: (@quote.content.length <= 300 ? @quote.content : @quote.content[0..299]),
57 url: quote_url(@quote, host: "www.fourisland.com"),
58 article: {
59 published_time: @quote.created_at.iso8601,
60 modified_time: @quote.updated_at.iso8601
61 }
62 })
63
53 respond_to do |format| 64 respond_to do |format|
54 format.html 65 format.html
55 format.json { render :json => @quote } 66 format.json { render :json => @quote }