omit .. for root index

This commit is contained in:
Crispy 2024-03-25 16:01:48 +01:00
parent 7f37d4a775
commit 210e24415e

View file

@ -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>"#,
); );