diff options
author | Vika <vika@fireburn.ru> | 2023-07-09 01:29:44 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2023-07-09 01:29:44 +0300 |
commit | 49cd7ac49aad4d60719979bae494ddf15ea37fa1 (patch) | |
tree | 6d4f4ed3f1eebf1aaf9455dccb77701ac08fd4e3 /kittybox-rs/templates | |
parent | 2156ed8d0ab62e677037b104c08489e5eed55733 (diff) | |
download | kittybox-49cd7ac49aad4d60719979bae494ddf15ea37fa1.tar.zst |
templates: fix cursor usage in feed template
Diffstat (limited to 'kittybox-rs/templates')
-rw-r--r-- | kittybox-rs/templates/src/mf2.rs | 14 |
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" - } - } } } |