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 published_at.rfc2822
end end
def feed_content
photos? ? "<div>#{photos.map { |p| "<img src='#{p["value"]}'/>" }.join("")} #{content}</div>" : content
end
def excerpt def excerpt
truncate_html(content, 140, true) truncate_html(content, 140, true)
end end

View File

@@ -11,7 +11,7 @@ xml.channel do |channel|
channel.item do |item| channel.item do |item|
item.title post.display_title item.title post.display_title
item.description do |desc| item.description do |desc|
desc.cdata! post.content desc.cdata! post.feed_content
end end
item.guid(post.slug, isPermaLink: true) item.guid(post.slug, isPermaLink: true)
item.pubDate post.machine_published_at 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" div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 = post.display_title 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? - if post.photos?
- post.photos.each do |photo| - 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 == post.content
div class="mb-4 max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600" 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" 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" div class="mb-12 max-w-prose mx-auto"
- posts.each do |post| - posts.each do |post|

View File

@@ -1435,6 +1435,10 @@ video {
color: rgb(219 234 254 / var(--tw-text-opacity)); color: rgb(219 234 254 / var(--tw-text-opacity));
} }
.prose-img\:rounded :is(:where(img):not(:where([class~="not-prose"] *))) {
border-radius: 0.25rem;
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
.dark\:border-gray-600 { .dark\:border-gray-600 {
--tw-border-opacity: 1; --tw-border-opacity: 1;