summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index a742cfe..0fccc2b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -125,12 +125,17 @@ fn main() {
for redirect in &website.redirects {
let mut destination = destination.clone();
destination.push(&redirect.full_url);
- if let Some(path) = website.has_page(redirect, &redirect.redirect, "html") {
- if args.html {
+ let path = &redirect.redirect;
+ if args.html {
+ if !path.contains("://") {
+ if let Some(path) = website.has_page(redirect, &path, "html") {
+ write_file(&generate_html_redirect(&path), &destination, "html");
+ } else {
+ warn!("Redirect {:?} links to nonexistent page {path:?}", redirect.name);
+ }
+ } else {
write_file(&generate_html_redirect(&path), &destination, "html");
}
- } else {
- warn!("Redirect {:?} links to nonexistent page {:?}", redirect.name, redirect.redirect);
}
}
}