limit default index to .md files only
This commit is contained in:
parent
bf423261ac
commit
c469ce364e
1 changed files with 8 additions and 1 deletions
|
@ -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::<Vec<&PathBuf>>()
|
||||
.first()
|
||||
.unwrap_or(&files.first().unwrap())
|
||||
.display()
|
||||
.to_string(),
|
||||
};
|
||||
|
||||
return Ok(HttpResponse::Found()
|
||||
|
|
Loading…
Reference in a new issue