Add domain to entry list
This commit is contained in:
@@ -6,6 +6,7 @@ use sqlx::PgPool;
|
||||
use crate::error::Result;
|
||||
use crate::models::entry::{get_entries, GetEntriesOptions};
|
||||
use crate::partials::layout::Layout;
|
||||
use crate::utils::get_domain;
|
||||
|
||||
pub async fn get(State(pool): State<PgPool>, layout: Layout) -> Result<Response> {
|
||||
let entries = get_entries(&pool, GetEntriesOptions::default()).await?;
|
||||
@@ -14,7 +15,8 @@ pub async fn get(State(pool): State<PgPool>, layout: Layout) -> Result<Response>
|
||||
@for entry in entries {
|
||||
@let title = entry.title.unwrap_or_else(|| "Untitled".to_string());
|
||||
@let url = format!("/entry/{}", entry.id);
|
||||
li { a href=(url) { (title) } }
|
||||
@let domain = get_domain(&entry.url).unwrap_or_default();
|
||||
li { a href=(url) { (title) } em class="domain" { (domain) }}
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user