Add hacky workaround for Mastodon link verification

This commit is contained in:
Zoey 2022-11-08 10:36:31 -08:00
parent c7a2d7028f
commit 2427d9547f

View file

@ -155,9 +155,14 @@ impl<'a> SiteBuilder<'a> {
}),
element!("a", |el| {
if let Some(href) = el.get_attribute("href") {
let me = href == "https://mas.to/@zyl";
if let Ok(href) = Url::parse(&href) {
if href.host().is_some() {
el.set_attribute("rel", "noopener noreferrer")?;
let mut rel = String::from("noopener noreferrer");
if me {
rel.push_str(" me");
}
el.set_attribute("rel", &rel)?;
el.set_attribute("target", "_blank")?;
}
}