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.push_str(&entry);
|
||||||
content
|
content
|
||||||
});
|
});
|
||||||
|
let parent = if relative_path != "/" {
|
||||||
|
r#" <li><a href="..">../</a></li>"#
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
let page = format!(
|
let page = format!(
|
||||||
r#"<!DOCTYPE html>
|
r#"<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -204,8 +209,7 @@ fn generate_index(relative_path: &str, path: &Path) -> Option<Content> {
|
||||||
<body>
|
<body>
|
||||||
<h3>Index of {relative_path}</h3>
|
<h3>Index of {relative_path}</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="..">../</a></li>
|
{parent}{list} </ul>
|
||||||
{list} </ul>
|
|
||||||
</body>
|
</body>
|
||||||
</html>"#,
|
</html>"#,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue