diff --git a/src/api/common.rs b/src/api/common.rs index ba8148e..9d5aad1 100644 --- a/src/api/common.rs +++ b/src/api/common.rs @@ -11,7 +11,7 @@ pub struct Articles { #[derive(Deserialize)] pub struct Pagination { pub size: u32, - pub total_size: u32, + pub total_size: Option, pub orderby: String, } diff --git a/src/routes/search.rs b/src/routes/search.rs index 9a0c0fa..6c161e8 100644 --- a/src/routes/search.rs +++ b/src/routes/search.rs @@ -91,7 +91,7 @@ fn render_articles( .as_ref() .map(|a| a.len() as u32) .unwrap_or(0); - let total = articles.pagination.total_size; + let total = articles.pagination.total_size.unwrap_or(0); let (has_prev, has_next) = (offset > 0, offset + count < total); let prev_page = if has_prev { let offset = offset.saturating_sub(steps); @@ -122,7 +122,7 @@ fn render_articles( li { a href=(&article.canonical_url) { (&article.title) } } } } - @if total != 0 { + @if has_prev || has_next { div.nav { a href=[prev_page] { "<" } ((offset + 1)) " to " ((offset + count)) " of " (total)