From c14501061f73e4a25e5e8a05b0596f16edd0afc3 Mon Sep 17 00:00:00 2001 From: darkicewolf50 Date: Tue, 3 Jun 2025 22:52:11 -0600 Subject: [PATCH] feat(master): version 2.0.2, changed to use articles in blogs, as well as many other things I do not remember --- Cargo.lock | 2 +- Cargo.toml | 2 +- assets/robots.txt | 2 ++ assets/styling/blog.css | 11 ++++++++++- src/components/mod.rs | 4 ++-- src/lib.rs | 6 +++--- src/views/blog.rs | 30 +++++++++++++++++------------- src/views/home.rs | 8 -------- src/views/mod.rs | 4 ++-- src/views/navbar.rs | 38 ++++++++++++++++++++++++++++++++++++++ 10 files changed, 76 insertions(+), 31 deletions(-) create mode 100644 assets/robots.txt diff --git a/Cargo.lock b/Cargo.lock index 12e9cf3..dda5464 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3179,7 +3179,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "personal_site" -version = "2.0.1" +version = "2.0.2" dependencies = [ "dioxus", "reqwest", diff --git a/Cargo.toml b/Cargo.toml index b7731b8..42c4d0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "personal_site" -version = "2.0.1" +version = "2.0.2" authors = ["darkicewolf50 "] edition = "2021" diff --git a/assets/robots.txt b/assets/robots.txt new file mode 100644 index 0000000..8875f68 --- /dev/null +++ b/assets/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /blogs/ diff --git a/assets/styling/blog.css b/assets/styling/blog.css index c511d77..a42c629 100644 --- a/assets/styling/blog.css +++ b/assets/styling/blog.css @@ -8,6 +8,14 @@ flex-direction: column; } +#blog_info ul { + display: flex; + flex-direction: row; + list-style-type: none; + margin: 0px; + padding: 0px; +} + #blog_info p { padding: 2svh 0svw; margin: 0px; @@ -17,6 +25,7 @@ padding: 1svh 1svw; margin: 2svh 0svw; margin-bottom: 0px; + font-size: 2em; } #blog_info div { @@ -40,7 +49,7 @@ #blog_info div p:last-child { margin-right: 10svh; } -#blog_info div div p { +#blog_info div ul li { background-color: rgba(128, 0, 128, 0.2); border-radius: 1rem; padding: 0.25svh 8px; diff --git a/src/components/mod.rs b/src/components/mod.rs index b12b942..4d07480 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -2,8 +2,8 @@ //! They can be used to defined common UI elements like buttons, forms, and modals. In this template, we define a Hero //! component to be used in our app. -mod hero; -pub use hero::Hero; +// mod hero; +// pub use hero::Hero; mod techs; pub use techs::TechCat; diff --git a/src/lib.rs b/src/lib.rs index 4ff70b1..424a08f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ use dioxus::prelude::*; // use components::Hero; -use views::{Blog, Blogs, ContactMe, Home, Navbar, NewHome, Projects}; +use views::{Blog, Blogs, ContactMe, Home, Navbar, Projects}; /// Define a components module that contains all shared components for our app. mod components; @@ -42,8 +42,8 @@ pub enum Route { #[route("/contact")] ContactMe {}, - #[route("/new_home")] - NewHome {}, + // #[route("/new_home")] + // NewHome {}, // PageNotFound is a catch all route that will match any route and placing the matched segments in the route field #[route("/:..route")] PageNotFound { route: Vec }, diff --git a/src/views/blog.rs b/src/views/blog.rs index e121b72..afd75d4 100644 --- a/src/views/blog.rs +++ b/src/views/blog.rs @@ -29,7 +29,8 @@ pub fn Blog(blog_title: String) -> Element { rsx! { document::Stylesheet { href: asset!("/assets/styling/blog.css") } document::Title { "Brock Tomlinson - {blog_title.clone()}" } - document::Meta { name: "author", content: "Brock Tomlinson" } + // document::Meta { name: "author", content: "Brock Tomlinson" } + document::Meta { name: "robots", content: "noindex, nofollow" } div { id: "blog", @@ -52,20 +53,22 @@ pub fn Blog(blog_title: String) -> Element { // span { " <---> " } Link { to: Route::Blogs { page_num: 0 }, "Go Back" } if let Some(blog_content) = &*blog_resource.read() { - div { id: "blog_info", - h1 { "{blog_content.blog_title}" } - div { + article { + header { id: "blog_info", + h1 { "{blog_content.blog_title}" } div { - for tag in &blog_content.tags { - p { "{tag}" } + ul { + for tag in &blog_content.tags { + li { "{tag}" } + } } + p { "{&blog_content.date_last_edit}" } } - p { "{&blog_content.date_last_edit}" } } - } - div { - id: "blog_content", - dangerous_inner_html: *&blog_content.html_blog_content.as_str(), + section { + id: "blog_content", + dangerous_inner_html: *&blog_content.html_blog_content.as_str(), + } } } else { p { "Loading..." } @@ -78,7 +81,7 @@ async fn get_blog(blog_name: String) -> Result { let client = reqwest::Client::new(); let res = client - .get(format!("/blogs/blog/{}", blog_name)) + .get(format!("blogs/blog/{}", blog_name)) .timeout(std::time::Duration::from_secs(10)) .send() .await? @@ -128,8 +131,9 @@ pub fn Blogs(page_num: u32) -> Element { rsx! { document::Stylesheet { href: asset!("/assets/styling/blog.css") } + document::Meta { name: "robots", content: "noindex, nofollow" } + document::Title { "Brock Tomlinson - Blogs" } div { id: "blogs", - document::Title { "Brock Tomlinson - Blogs" } div { id: "blogs-title", h1 { "Blogs" } p { diff --git a/src/views/home.rs b/src/views/home.rs index 9d70a6d..704a601 100644 --- a/src/views/home.rs +++ b/src/views/home.rs @@ -1,5 +1,4 @@ use crate::components::{Experience, TechCat}; -use crate::helper_fun::set_meta_tags; use crate::views::{Contact, Projects}; use crate::Route; use dioxus::prelude::*; @@ -33,13 +32,6 @@ pub fn Home() -> Element { rsx!( document::Title { "Brock Tomlinson - Home" } document::Stylesheet { href: asset!("/assets/styling/home.css") } - set_meta_tags { - description: "a fourth year Software Engineering Student specializing in full-stack development with a strong focus on backend technologies. - I am developing the language of how to design, develop, and create programs that are to industry standards and reasonably efficent. - I bring the lessons learned from each project I have completed, - learning from the mistakes I have made and bringing improved versions forward into the next project.", - keywords: "webdev Rust software engineer projects blog darkicewol50", - } div { div { id: "home-intro", h1 { "Hi I'm Brock" } diff --git a/src/views/mod.rs b/src/views/mod.rs index 33116f4..136a42b 100644 --- a/src/views/mod.rs +++ b/src/views/mod.rs @@ -8,8 +8,8 @@ //! The [`Navbar`] component will be rendered on all pages of our app since every page is under the layout. The layout defines //! a common wrapper around all child routes. -mod new_home; -pub use new_home::NewHome; +// mod new_home; +// pub use new_home::NewHome; mod blog; pub use blog::{Blog, Blogs}; diff --git a/src/views/navbar.rs b/src/views/navbar.rs index 4192823..dd3df7d 100644 --- a/src/views/navbar.rs +++ b/src/views/navbar.rs @@ -1,7 +1,11 @@ use crate::components::Ender; +use crate::helper_fun::set_meta_tags; use crate::Route; use dioxus::prelude::*; +const _ROBOTS_TXT: Asset = asset!("/assets/robots.txt"); +const PROFESSIONAL_PHOTO_JPG: Asset = asset!("assets/professional_photo_2023.jpg"); + /// The Navbar component that will be rendered on all pages of our app since every page is under the layout. /// /// @@ -9,9 +13,43 @@ use dioxus::prelude::*; /// routes will be rendered under the outlet inside this component #[component] pub fn Navbar() -> Element { + let PHOTO_FORMAT_URL = format!("https://darkicewolf50.pages.dev{PROFESSIONAL_PHOTO_JPG}"); rsx! { document::Stylesheet { href: asset!("/assets/styling/navbar.css") } document::Stylesheet { href: asset!("assets/styling/standardColoursandFonts.css") } + set_meta_tags { + description: "Fourth year Software Engineering student specializing in full-stack development with a backend focus. Always improving through experience.", + keywords: "webdev Rust software engineer projects blog darkicewol50", + } + document::Meta { name: "robots", content: "index, follow" } + document::Link { rel: "canonical", href: "https://darkicewolf50.pages.dev/" } + document::Meta { + name: "google-site-verification", + content: "lsAs9c2Pv7c6Sm26z1hd2YqR2depbp4sJddIDYKHkxY", + } + document::Meta { + property: "og:title", + content: "Brock Tomlinson - Software Engineering Student", + } + document::Meta { + property: "og:description", + content: "Fourth year Software Engineering student specializing in full-stack development with a backend focus. Always improving through experience.", + } + document::Meta { property: "og:type", content: "website" } + document::Meta { property: "og:url", content: "https://darkicewolf50.pages.dev/" } + + document::Meta { name: "twitter:card", content: "summary_large_image" } + document::Meta { + name: "twitter:title", + content: "Brock Tomlinson - Software Engineer", + } + document::Meta { + name: "twitter:description", + content: "Fourth year Software Engineering student specializing in full-stack development with a backend focus. Always improving through experience.", + } + document::Meta { name: "twitter:image", content: PHOTO_FORMAT_URL.clone() } + + document::Meta { property: "og:image", content: PHOTO_FORMAT_URL.clone() } div { id: "navbar", Link { to: Route::Home {}, "Home" }