about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/frontend/mod.rs2
-rw-r--r--templates/src/mf2.rs10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs
index 4120b55..69f6aa5 100644
--- a/src/frontend/mod.rs
+++ b/src/frontend/mod.rs
@@ -367,7 +367,7 @@ pub async fn catchall<D: Storage>(
                     feeds: channels,
                     user: session.as_deref(),
                     content: match post.pointer("/type/0").and_then(|i| i.as_str()) {
-                        Some("h-entry") => Entry { post: &post }.to_string(),
+                        Some("h-entry") => Entry { post: &post, from_feed: false, }.to_string(),
                         Some("h-feed") => Feed { feed: &post, cursor: cursor.as_deref() }.to_string(),
                         Some("h-card") => VCard { card: &post }.to_string(),
                         unknown => {
diff --git a/templates/src/mf2.rs b/templates/src/mf2.rs
index 0b33f9f..4a683d6 100644
--- a/templates/src/mf2.rs
+++ b/templates/src/mf2.rs
@@ -21,9 +21,9 @@ fn decode_geo_uri(uri: &str) -> String {
 }
 
 markup::define! {
-    Entry<'a>(post: &'a serde_json::Value) {
+    Entry<'a>(post: &'a serde_json::Value, from_feed: bool) {
         @if post.pointer("/properties/like-of").is_none() && post.pointer("/properties/bookmark-of").is_none() {
-            @FullEntry { post }
+            @FullEntry { post, from_feed: *from_feed }
         } else {
             // Show a mini-post.
             @MiniEntry { post }
@@ -96,7 +96,7 @@ markup::define! {
             }
         }
     }
-    FullEntry<'a>(post: &'a serde_json::Value) {
+    FullEntry<'a>(post: &'a serde_json::Value, from_feed: bool) {
         article."h-entry" {
             header.metadata {
                 @if let Some(name) = post["properties"]["name"][0].as_str() {
@@ -121,7 +121,7 @@ markup::define! {
                 }
                 div {
                     span {
-                        a."u-url"."u-uid"[href=post["properties"]["uid"][0].as_str().unwrap()] {
+                        a."u-url"."u-uid"[href=post["properties"]["uid"][0].as_str().unwrap(), rel=(!from_feed).then_some("canonical")] {
                             @if let Some(published) = post["properties"]["published"][0].as_str() {
                                 time."dt-published"[datetime=published] {
                                     @chrono::DateTime::parse_from_rfc3339(published)
@@ -367,7 +367,7 @@ markup::define! {
             @if feed["children"].is_array() {
                 @for child in feed["children"].as_array().unwrap() {
                     @match child["type"][0].as_str().unwrap() {
-                        "h-entry" => { @Entry { post: child } }
+                        "h-entry" => { @Entry { post: child, from_feed: true, } }
                         "h-feed" => { @Feed { feed: child, cursor: None } }
                         "h-food" => { @Food { food: child } }
                         //"h-event" => { }