separated html

This commit is contained in:
WanderingPenwing 2024-09-02 01:49:02 +02:00
parent d5326389d5
commit b5839f6077
2 changed files with 46 additions and 47 deletions

45
src/common.html Normal file
View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>yuya</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Penwing's Website">
<link rel="stylesheet" href="/assets/style.css">
<link rel="icon" href="/assets/flake.png" type="image/png">
</head>
<body>
<div class="sidenav">
<h3><a href="/">Summary</a></h3>
<h3><a href="/tools">Tools</a></h3>
<a class="description" href="https://www.penwing.org/tools.html#nginx">proxy</a>
<a class="description" href="https://www.penwing.org/tools.html#cloudflare">domain</a>
<a class="description" href="https://www.penwing.org/tools.html#portainer">dashboard</a>
<a class="description" href="https://www.penwing.org/tools.html#pihole">adblocker</a>
<a class="description" href="https://www.penwing.org/tools.html#searxng">search</a>
<a class="description" href="https://www.penwing.org/tools.html#forgejo">git server</a>
<a class="description" href="https://www.penwing.org/tools.html#jellyfin">streaming</a>
<a class="description" href="https://www.penwing.org/tools.html#stirling">pdf edit</a>
<a class="description" href="https://www.penwing.org/tools.html#seafile">storage</a>
<h3><a href="https://www.penwing.org/art.html">my Art</a></h3>
<h3><a href="https://www.penwing.org/games.html">my Games</a></h3>
</div>
<p class="topbar">
<a href="/">Home</a> -
<a href="/tools">Tools</a> -
<a href="/art">Art</a> -
<a href="/games">Games</a>
</p>
<div class="main">
#CONTENT#
<hr>
<p id="spacer"><br></p>
<h2 id="epilogue">Epilogue</h2>
<p>Inspired by the geniuses behind <a href="https://perfectmotherfuckingwebsite.com/">perfectwebsite.com</a>,
because a webpage does not have to be heavier than <a href="https://github.com/chrislgarry/Apollo-11">the code that took us to the moon</a>.</p>
<p>This page is licensed under <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a></p>
</div>
</body></html>

View file

@ -17,53 +17,7 @@ async fn serve_markdown(file_path: &str) -> impl Responder {
let html_content = markdown_to_html(&markdown_content);
// Create the common HTML wrapper
let common_html = r#"
<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>yuya</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Penwing's Website">
<link rel="stylesheet" href="/assets/style.css">
<link rel="icon" href="/assets/flake.png" type="image/png">
</head>
<body>
<div class="sidenav">
<h3><a href="/">Summary</a></h3>
<h3><a href="/tools">Tools</a></h3>
<a class="description" href="https://www.penwing.org/tools.html#nginx">proxy</a>
<a class="description" href="https://www.penwing.org/tools.html#cloudflare">domain</a>
<a class="description" href="https://www.penwing.org/tools.html#portainer">dashboard</a>
<a class="description" href="https://www.penwing.org/tools.html#pihole">adblocker</a>
<a class="description" href="https://www.penwing.org/tools.html#searxng">search</a>
<a class="description" href="https://www.penwing.org/tools.html#forgejo">git server</a>
<a class="description" href="https://www.penwing.org/tools.html#jellyfin">streaming</a>
<a class="description" href="https://www.penwing.org/tools.html#stirling">pdf edit</a>
<a class="description" href="https://www.penwing.org/tools.html#seafile">storage</a>
<h3><a href="https://www.penwing.org/art.html">my Art</a></h3>
<h3><a href="https://www.penwing.org/games.html">my Games</a></h3>
</div>
<p class="topbar">
<a href="/">Home</a> -
<a href="/tools">Tools</a> -
<a href="/art">Art</a> -
<a href="/games">Games</a>
</p>
<div class="main">
#CONTENT#
<hr>
<p id="spacer"><br></p>
<h2 id="epilogue">Epilogue</h2>
<p>Inspired by the geniuses behind <a href="https://perfectmotherfuckingwebsite.com/">perfectwebsite.com</a>,
because a webpage does not have to be heavier than <a href="https://github.com/chrislgarry/Apollo-11">the code that took us to the moon</a>.</p>
<p>This page is licensed under <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a></p>
</div>
</body></html>
"#;
let common_html = include_str!("common.html");
// Replace #CONTENT# placeholder with the actual Markdown HTML content
let page_html = common_html.replace("#CONTENT#", &html_content);