1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use crate::env::global_config;
use actix_web::HttpRequest;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Tags {
pub title: String,
#[serde(rename = "type")]
pub og_type: String,
pub url: String,
pub description: String,
pub image: String,
pub site_name: String,
}
impl Tags {
pub fn for_request(request: &HttpRequest) -> Self {
Tags {
url: request.uri().to_string(),
..Self::default()
}
}
}
impl Default for Tags {
fn default() -> Self {
Tags {
title: "Rensselaer Center for Open Source".to_string(),
og_type: "website".to_string(),
url: global_config().telescope_url.clone(),
description: "The Rensselaer Center for Open Source - or RCOS (ar-kos) for short - is \
a community of motivated students at Rensselaer Polytechnic Institute who develop \
open source projects under the guidance of experienced instructors and student \
mentors."
.to_string(),
image: format!(
"{}/{}",
global_config().telescope_url,
"static/icons/rcos-branding/img/logo-square-red.png"
),
site_name: "Telescope".to_string(),
}
}
}