Improve suport for image posts

This commit is contained in:
2023-02-06 15:03:18 +11:00
parent 2c56fafc49
commit 811affc9b3
5 changed files with 15 additions and 4 deletions

View File

@@ -42,6 +42,10 @@ module Adamantium
published_at.rfc2822
end
def feed_content
photos? ? "<div>#{photos.map { |p| "<img src='#{p["value"]}'/>" }.join("")} #{content}</div>" : content
end
def excerpt
truncate_html(content, 140, true)
end

View File

@@ -11,7 +11,7 @@ xml.channel do |channel|
channel.item do |item|
item.title post.display_title
item.description do |desc|
desc.cdata! post.content
desc.cdata! post.feed_content
end
item.guid(post.slug, isPermaLink: true)
item.pubDate post.machine_published_at

View File

@@ -1,10 +1,13 @@
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 = post.display_title
article class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200 prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline"
article class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200 prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline prose-img:rounded"
- if post.photos?
- post.photos.each do |photo|
img src=photo["value"] alt=photo["alt"]
figure
img src=photo["value"] alt=photo["alt"]
figcaption
= photo["alt"]
== post.content
div class="mb-4 max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600"

View File

@@ -1,5 +1,5 @@
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 = "Tagged: \"#{tag.label}\""
h2 = "#{posts.count} item(s) tagged \"#{tag.label}\""
div class="mb-12 max-w-prose mx-auto"
- posts.each do |post|