diff --git a/pages/common.html b/pages/common.html new file mode 100644 index 0000000..8b8b00d --- /dev/null +++ b/pages/common.html @@ -0,0 +1,46 @@ + + + Yuya + + + + + + +
+

Summary

+

Tools

+ proxy + domain + dashboard + adblocker + search + git server + streaming + pdf edit + storage + +

my Art

+

my Games

+
+

+Home - +Tools - +Art - +Games +

+
+#CONTENT# +


+
+


+ +

Epilogue

+ +

Inspired by the geniuses behind perfectwebsite.com, +because a webpage does not have to be heavier than the code that took us to the moon.

+ +

This page is licensed under CC0

+ +
+ diff --git a/pages/summary.md b/pages/summary.md index 8bbcdf9..ef8f6c9 100644 --- a/pages/summary.md +++ b/pages/summary.md @@ -1,4 +1,4 @@ -# The Igloo ❄ +# Yuya Welcome to *penwing's* website. diff --git a/pages/tools.md b/pages/tools.md index 0be9912..dd0ec8b 100644 --- a/pages/tools.md +++ b/pages/tools.md @@ -1,4 +1,4 @@ -# The Igloo - Tools +# Yuya - Tools ###### nginx diff --git a/src/main.rs b/src/main.rs index c90753b..23120ab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,6 @@ fn slugify(text: &str) -> String { fn markdown_to_html(markdown_content: &str) -> String { let parser = Parser::new(markdown_content); - let mut html_output = String::new(); let mut events = Vec::new(); let mut in_header = false; let mut header_text = String::new(); @@ -47,13 +46,13 @@ fn markdown_to_html(markdown_content: &str) -> String { async fn serve_markdown(file_path: &str) -> impl Responder { // Read the Markdown file - let markdown_content = fs::read_to_string(file_path).unwrap_or_else(|_| String::from("Error reading file")); + let markdown_content = fs::read_to_string(file_path).unwrap_or_else(|_| String::from("Error reading markdown file")); // Convert Markdown to HTML let html_content = markdown_to_html(&markdown_content); // Create the common HTML wrapper - let common_html = include_str!("common.html"); + let common_html = fs::read_to_string("pages/common.html").unwrap_or_else(|_| String::from("Error reading html file")); // Replace #CONTENT# placeholder with the actual Markdown HTML content let page_html = common_html.replace("#CONTENT#", &html_content); @@ -61,6 +60,7 @@ async fn serve_markdown(file_path: &str) -> impl Responder { HttpResponse::Ok().content_type("text/html").body(page_html) } + async fn summary() -> impl Responder { serve_markdown("pages/summary.md").await }