about summary refs log tree commit diff
path: root/templates/src
diff options
context:
space:
mode:
Diffstat (limited to 'templates/src')
-rw-r--r--templates/src/mf2.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/templates/src/mf2.rs b/templates/src/mf2.rs
index 4a683d6..076989c 100644
--- a/templates/src/mf2.rs
+++ b/templates/src/mf2.rs
@@ -283,12 +283,22 @@ markup::define! {
                 }
             }
             @PhotoGallery { photos: post["properties"]["photo"].as_array() }
-            @if post["properties"]["content"][0]["html"].is_string() {
+            @if *from_feed {
+                @if let Some(summary) = post["properties"]["summary"][0].as_str() {
+                    p."p-summary" { @summary }
+                    a[href=post["properties"]["uid"][0].as_str().unwrap()] { "Read more.." }
+                } else if let Some(content) = post["properties"]["content"][0]["html"].as_str() {
+                    // TODO: ellipsize content by showing only the first paragraph
+                    main."e-content" {
+                        @markup::raw(content.trim())
+                    }
+                }
+            } else if let Some(content) = post["properties"]["content"][0]["html"].as_str() {
                 main."e-content" {
-                    @markup::raw(post["properties"]["content"][0]["html"].as_str().unwrap().trim())
+                    @markup::raw(content.trim())
                 }
             }
-            @WebInteractions { post }
+            @WebInteractions { post, from_feed: *from_feed }
         }
     }
     VCard<'a>(card: &'a serde_json::Value) {
@@ -424,7 +434,7 @@ markup::define! {
             }
         }
     }
-    WebInteractions<'a>(post: &'a serde_json::Value) {
+    WebInteractions<'a>(post: &'a serde_json::Value, from_feed: bool) {
         footer.webinteractions {
             p[style="display: none", "aria-hidden"="false"] {
                 "Webmention counters:"
@@ -451,7 +461,7 @@ markup::define! {
                     span.counter { @post["properties"]["bookmark"].as_array().map(|a| a.len()).unwrap_or(0) }
                 }
             }
-            /*@if (
+            /*@if *from_feed && (
                 post["properties"]["like"].as_array().map(|a| a.len()).unwrap_or(0)
                     + post["properties"]["bookmark"].as_array().map(|a| a.len()).unwrap_or(0)
                     + post["properties"]["repost"].as_array().map(|a| a.len()).unwrap_or(0)