about summary refs log tree commit diff
path: root/kittybox-rs
diff options
context:
space:
mode:
Diffstat (limited to 'kittybox-rs')
-rw-r--r--kittybox-rs/templates/src/mf2.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/kittybox-rs/templates/src/mf2.rs b/kittybox-rs/templates/src/mf2.rs
index 7f943d3..33cd84a 100644
--- a/kittybox-rs/templates/src/mf2.rs
+++ b/kittybox-rs/templates/src/mf2.rs
@@ -324,7 +324,7 @@ markup::define! {
                     .iter()
                     .filter_map(|v| v.as_str())
                     .filter(|v| v != &card["properties"]["uid"][0].as_str().unwrap())
-                    .filter(|v| !v.starts_with(card["properties"]["author"][0].as_str().unwrap()))
+                    .filter(|v| !card["properties"]["author"][0].as_str().is_some_and(|a| v.starts_with(a)))
                     {
                         li { a."u-url"[href=url, rel="me"] { @url } }
                     }
@@ -374,7 +374,11 @@ markup::define! {
                     }
                 }
             }
-            @if feed["children"].as_array().map(|a| a.len()).unwrap_or(0) == 0 {
+            @if let Some(cursor) = cursor {
+                a[rel="prev", href=format!("{}?after={}", feed["properties"]["uid"][0].as_str().unwrap(), cursor)] {
+                    "Older posts"
+                }
+            } else {
                 p {
                     "Looks like you reached the end. Wanna jump back to the "
                     a[href=feed["properties"]["uid"][0].as_str().unwrap()] {
@@ -382,12 +386,6 @@ markup::define! {
                     } "?"
                 }
             }
-            @if feed["children"].as_array().map(|a| a.len()).unwrap_or(0) == super::POSTS_PER_PAGE {
-                a[rel="prev", href=feed["properties"]["uid"][0].as_str().unwrap().to_string()
-                    + "?after=" + feed["children"][super::POSTS_PER_PAGE - 1]["properties"]["uid"][0].as_str().unwrap()] {
-                    "Older posts"
-                }
-            }
         }
     }