From c79d5a479a28610dfc1844ca8a9135bcc201134f Mon Sep 17 00:00:00 2001 From: Pantonshire Date: Wed, 18 May 2022 16:36:38 +0100 Subject: [PATCH] Contact page --- blog_server/src/service/contact.rs | 34 ++++++++++++++++++++++++++++++ blog_server/src/service/mod.rs | 1 + blog_server/src/service/site.rs | 2 ++ 3 files changed, 37 insertions(+) create mode 100644 blog_server/src/service/contact.rs diff --git a/blog_server/src/service/contact.rs b/blog_server/src/service/contact.rs new file mode 100644 index 0000000..7a771a9 --- /dev/null +++ b/blog_server/src/service/contact.rs @@ -0,0 +1,34 @@ +use maud::html; + +use crate::template; +use super::response::HtmlResponse; + +pub async fn handle() -> HtmlResponse { + HtmlResponse::new() + .with_title_static("Contact") + .with_crawler_permissive() + .with_head(html! { + link href="/static/styles/main.css" rel="stylesheet"; + }) + .with_body(template::main_page(html! { + section .content_section { + h1 { "Contact" } + p { + "If you want to contact me, you can find me at:" + } + ul { + li { + "Twitter: " + a href="https://twitter.com/pantonshire" { "@pantonshire" } + } + li { + "Mastodon: " + a href="https://tech.lgbt/web/@pantonshire#" { "@pantonshire@tech.lgbt" } + } + li { + "Discord: pantonshire#2076" + } + } + } + })) +} diff --git a/blog_server/src/service/mod.rs b/blog_server/src/service/mod.rs index 27b05cf..c396b10 100644 --- a/blog_server/src/service/mod.rs +++ b/blog_server/src/service/mod.rs @@ -1,3 +1,4 @@ +mod contact; mod index; mod post; mod posts_list; diff --git a/blog_server/src/service/site.rs b/blog_server/src/service/site.rs index 997cedd..fde8fca 100644 --- a/blog_server/src/service/site.rs +++ b/blog_server/src/service/site.rs @@ -13,6 +13,7 @@ use tracing::info; use crate::posts_store::ConcurrentPostsStore; use super::{ + contact, index, post, posts_list, @@ -28,6 +29,7 @@ pub fn service( { Router::new() .route("/", get(index::handle)) + .route("/contact", get(contact::handle)) .route("/articles", get(posts_list::handle)) .route("/articles/:post_id", get(post::handle)) .nest("/static", static_content::service(static_dir))