diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 5a04b9f8..22f02442 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -181,11 +181,14 @@ impl Post { } pub fn to_json(&self, conn: &PgConnection) -> serde_json::Value { + let blog = self.get_blog(conn); json!({ "post": self, "author": self.get_authors(conn)[0].to_json(conn), - "url": format!("/~/{}/{}/", self.get_blog(conn).actor_id, self.slug), - "date": self.creation_date.timestamp() + "url": format!("/~/{}/{}/", blog.actor_id, self.slug), + "date": self.creation_date.timestamp(), + "blog": blog, + "blog_url": format!("/~/{}", blog.actor_id) }) } diff --git a/templates/macros.html.tera b/templates/macros.html.tera index d474a6be..62d90dc3 100644 --- a/templates/macros.html.tera +++ b/templates/macros.html.tera @@ -18,6 +18,7 @@ link_4="") }} ⋅ {{ article.date | date(format="%B %e") }} + ⋅ {{article.blog.title}}

{% endmacro post_card %}