server: only add "view on site" link if it's not in the html body
This commit is contained in:
parent
a81a803cca
commit
9a078cd238
@ -121,11 +121,11 @@ impl Transformer for InlineStyle {
|
||||
struct AddOutlink(Option<url::Url>);
|
||||
|
||||
impl Transformer for AddOutlink {
|
||||
fn should_run(&self, _: &str) -> bool {
|
||||
self.0
|
||||
.as_ref()
|
||||
.map(|l| l.scheme().starts_with("http"))
|
||||
.unwrap_or(false)
|
||||
fn should_run(&self, html: &str) -> bool {
|
||||
if let Some(link) = &self.0 {
|
||||
return link.scheme().starts_with("http") && !html.contains(link.as_str());
|
||||
}
|
||||
false
|
||||
}
|
||||
fn transform(&self, html: &str) -> Result<String, TransformError> {
|
||||
if let Some(url) = &self.0 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user