diff --git a/src/main.rs b/src/main.rs index 8ac21e6..32f69e7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -124,7 +124,14 @@ async fn render( if path.is_empty() { let location = match state.index_file.as_ref() { Some(index_file) => index_file.clone(), - None => files.get(0).unwrap().display().to_string(), + None => files + .iter() + .filter(|f| f.to_str().unwrap().ends_with(".md")) + .collect::>() + .first() + .unwrap_or(&files.first().unwrap()) + .display() + .to_string(), }; return Ok(HttpResponse::Found()