Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/llms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class LlmsController < ApplicationController
allow_unauthenticated_access

def show
@books = Book.published.ordered
@books = Book.accessable_or_published.ordered.includes(leaves: :leafable)
render content_type: "text/plain"
end
end
4 changes: 2 additions & 2 deletions app/helpers/leaves_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def leaf_og_description(leaf, book)

def leaf_og_image(leaf, book)
if leaf.picture? && leaf.picture.image.attached?
"#{root_url}#{url_for(leaf.picture.image)}"
url_for(leaf.picture.image)
elsif book.cover.attached?
"#{root_url}#{url_for(book.cover)}"
url_for(book.cover)
else
asset_url("covers/cover-#{book.theme}-og.png")
end
Expand Down
9 changes: 5 additions & 4 deletions app/views/books/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
<% @layout_class = "book" %>

<% content_for :head do %>
<%= tag.meta name: "description", content: (@book.subtitle.presence || @book.title) %>
<%= tag.meta property: "og:title", content: @book.title %>
<%= tag.meta property: "og:description", content: @book.subtitle %>
<%= tag.meta property: "og:image", content: @book.cover.blank? ? asset_url("covers/cover-#{@book.theme}-og.png") : "#{root_url}#{url_for(@book.cover)}" %>
<%= tag.meta property: "og:description", content: (@book.subtitle.presence || @book.title) %>
<%= tag.meta property: "og:image", content: @book.cover.blank? ? asset_url("covers/cover-#{@book.theme}-og.png") : url_for(@book.cover) %>
<%= tag.meta property: "og:url", content: book_slug_url(@book) %>

<%= tag.meta property: "twitter:title", content: @book.title %>
<%= tag.meta property: "twitter:description", content: @book.subtitle %>
<%= tag.meta property: "twitter:image", content: @book.cover.blank? ? asset_url("covers/cover-#{@book.theme}-og.png") : "#{root_url}#{url_for(@book.cover)}" %>
<%= tag.meta property: "twitter:description", content: (@book.subtitle.presence || @book.title) %>
<%= tag.meta property: "twitter:image", content: @book.cover.blank? ? asset_url("covers/cover-#{@book.theme}-og.png") : url_for(@book.cover) %>
<%= tag.meta property: "twitter:card", content: "summary_large_image" %>
<link rel="canonical" href="<%= book_slug_url(@book) %>">
<% end %>
Expand Down
1 change: 1 addition & 0 deletions app/views/leafables/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<% content_for(:title) { page_title(@leaf, @book) } %>

<% content_for :head do %>
<%= tag.meta name: "description", content: leaf_og_description(@leaf, @book) %>
<%= tag.meta property: "og:title", content: page_title(@leaf, @book) %>
<%= tag.meta property: "og:description", content: leaf_og_description(@leaf, @book) %>
<%= tag.meta property: "og:url", content: leafable_slug_url(@leaf) %>
Expand Down
9 changes: 9 additions & 0 deletions app/views/llms/show.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@
<% @books.each do |book| %>
- [<%= book.title %>](<%= book_slug_url(book) %>)<%= book.subtitle.present? ? " — #{book.subtitle}" : "" %><%= book.author.present? ? " by #{book.author}" : "" %>
<% end %>
<% @books.each do |book| %>

---

## [<%= book.title %>](<%= book_slug_url(book) %>)
<% book.leaves.active.positioned.each do |leaf| %>
- [<%= leaf.title %>](<%= leafable_slug_url(leaf) %>)
<% end %>
<% end %>