Add aggregation opengraph tags

This commit is contained in:
asonix 2020-12-08 17:32:37 -06:00
parent 35853612c3
commit 5aa9f2ed42
4 changed files with 16 additions and 5 deletions

2
Cargo.lock generated
View file

@ -1334,7 +1334,7 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]] [[package]]
name = "pict-rs-aggregator" name = "pict-rs-aggregator"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"anyhow", "anyhow",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "pict-rs-aggregator" name = "pict-rs-aggregator"
version = "0.1.0" version = "0.1.1"
authors = ["asonix <asonix@asonix.dog>"] authors = ["asonix <asonix@asonix.dog>"]
edition = "2018" edition = "2018"
build = "src/build.rs" build = "src/build.rs"

View file

@ -448,7 +448,13 @@ async fn view_aggregation(
let mut cursor = Cursor::new(vec![]); let mut cursor = Cursor::new(vec![]);
self::templates::view_aggregation(&mut cursor, &aggregation, &entries, &state)?; self::templates::view_aggregation(
&mut cursor,
path.aggregation,
&aggregation,
&entries,
&state,
)?;
Ok(HttpResponse::Ok() Ok(HttpResponse::Ok()
.content_type(mime::TEXT_HTML.essence_str()) .content_type(mime::TEXT_HTML.essence_str())

View file

@ -2,9 +2,14 @@
@use super::{layout, image_preview}; @use super::{layout, image_preview};
@use uuid::Uuid; @use uuid::Uuid;
@(aggregation: &Aggregation, entries: &[(Uuid, Entry)], state: &State) @(id: Uuid, aggregation: &Aggregation, entries: &[(Uuid, Entry)], state: &State)
@:layout(state, "Aggregation", None, {}, { @:layout(state, &aggregation.title, Some(&aggregation.description), {
<meta property="og:url" content="@state.public_aggregation_path(id)" />
@for (_, entry) in entries {
<meta property="og:image" content="@state.image_path(entry)" />
}
}, {
<section> <section>
<article> <article>
<div class="content-group"> <div class="content-group">