omit .. for root index
This commit is contained in:
parent
7f37d4a775
commit
210e24415e
1 changed files with 6 additions and 2 deletions
|
@ -195,6 +195,11 @@ fn generate_index(relative_path: &str, path: &Path) -> Option<Content> {
|
|||
content.push_str(&entry);
|
||||
content
|
||||
});
|
||||
let parent = if relative_path != "/" {
|
||||
r#" <li><a href="..">../</a></li>"#
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let page = format!(
|
||||
r#"<!DOCTYPE html>
|
||||
<head>
|
||||
|
@ -204,8 +209,7 @@ fn generate_index(relative_path: &str, path: &Path) -> Option<Content> {
|
|||
<body>
|
||||
<h3>Index of {relative_path}</h3>
|
||||
<ul>
|
||||
<li><a href="..">../</a></li>
|
||||
{list} </ul>
|
||||
{parent}{list} </ul>
|
||||
</body>
|
||||
</html>"#,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue