diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-21 13:31:37 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-21 13:31:37 -0400 |
| commit | 76acaf441208279355fb913afff06618c7d5dfbd (patch) | |
| tree | bede648498400bedb78d1815c0b17e8d0f25b301 /app | |
| parent | 0d50b1f18993827cb6862efeedea528b64fad164 (diff) | |
| download | thoughts-76acaf441208279355fb913afff06618c7d5dfbd.tar.gz thoughts-76acaf441208279355fb913afff06618c7d5dfbd.tar.bz2 thoughts-76acaf441208279355fb913afff06618c7d5dfbd.zip | |
Added OpenGraph link preview tags for quotes
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/quotes_controller.rb | 11 | ||||
| -rw-r--r-- | app/views/layouts/quotes.html.haml | 1 |
2 files changed, 12 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 } |
| diff --git a/app/views/layouts/quotes.html.haml b/app/views/layouts/quotes.html.haml index 5555248..68607f6 100644 --- a/app/views/layouts/quotes.html.haml +++ b/app/views/layouts/quotes.html.haml | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | = javascript_include_tag "application" | 7 | = javascript_include_tag "application" |
| 8 | = csrf_meta_tag | 8 | = csrf_meta_tag |
| 9 | = auto_discovery_link_tag :atom, latest_quotes_url(:atom) | 9 | = auto_discovery_link_tag :atom, latest_quotes_url(:atom) |
| 10 | = display_meta_tags og: { site_name: "Four Island" } | ||
| 10 | %body | 11 | %body |
| 11 | #wrap | 12 | #wrap |
| 12 | %header#banner | 13 | %header#banner |
