diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index ad6e40a2..a81b88f9 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -327,6 +327,19 @@ impl Blog { }) } + pub fn url(&self) -> String { + format!( + "https://{}", + self.custom_domain + .clone() + .unwrap_or_else(|| Host::new(format!( + "{}/~/{}", + Instance::get_local().unwrap().public_domain, + self.title + ))) + ) + } + pub fn icon_url(&self, conn: &Connection) -> String { self.icon_id .and_then(|id| Media::get(conn, id).and_then(|m| m.url()).ok()) diff --git a/templates/blogs/details.rs.html b/templates/blogs/details.rs.html index 71c87a71..571b1139 100644 --- a/templates/blogs/details.rs.html +++ b/templates/blogs/details.rs.html @@ -13,8 +13,8 @@ - - + +