add url to Blog, this seems useful.
This commit is contained in:
parent
8e7f789969
commit
9cee38ae6a
@ -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 {
|
pub fn icon_url(&self, conn: &Connection) -> String {
|
||||||
self.icon_id
|
self.icon_id
|
||||||
.and_then(|id| Media::get(conn, id).and_then(|m| m.url()).ok())
|
.and_then(|id| Media::get(conn, id).and_then(|m| m.url()).ok())
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
<meta content="120" property="og:image:width" />
|
<meta content="120" property="og:image:width" />
|
||||||
<meta content="120" property="og:image:height" />
|
<meta content="120" property="og:image:height" />
|
||||||
<meta content="summary" property="twitter:card" />
|
<meta content="summary" property="twitter:card" />
|
||||||
<meta content="'@Instance::get_local().unwrap().name" property="og:site_name" />
|
<meta content="@Instance::get_local().unwrap().name" property="og:site_name" />
|
||||||
<meta content="@blog.ap_url" property="og:url" />
|
<meta content="@blog.url()" property="og:url" />
|
||||||
<meta content="@blog.fqn" property="profile:username" />
|
<meta content="@blog.fqn" property="profile:username" />
|
||||||
<meta content="@blog.title" property="og:title" />
|
<meta content="@blog.title" property="og:title" />
|
||||||
<meta content="@blog.summary_html" name="description">
|
<meta content="@blog.summary_html" name="description">
|
||||||
|
Loading…
Reference in New Issue
Block a user