feat(dioxus): added meta tags to most pages, except the blog page-asaddsasd

This commit is contained in:
darkicewolf50 2025-05-20 17:44:02 -06:00
parent bff6a997be
commit 1bd70c4eb2
6 changed files with 35 additions and 3 deletions

View File

@ -9,6 +9,15 @@ pub fn get_tech_logos_from_str(used_tech: &'static str) -> Element {
} }
} }
#[component]
pub fn set_meta_tags(description: &'static str, keywords: &'static str) -> Element {
rsx! {
document::Meta { name: "description", content: description }
document::Meta { name: "keywords", content: keywords }
document::Meta { name: "author", content: "Brock Tomlinson" }
}
}
#[derive(PartialEq, Props, Clone, Copy)] #[derive(PartialEq, Props, Clone, Copy)]
pub struct TechDes { pub struct TechDes {
pub tech_name: &'static str, pub tech_name: &'static str,

View File

@ -1,5 +1,6 @@
use dioxus::prelude::*; use dioxus::prelude::*;
pub use helper_fun::set_meta_tags;
// use components::Hero; // use components::Hero;
use views::{Blog, Blogs, ContactMe, Home, Navbar, NewHome, Projects}; use views::{Blog, Blogs, ContactMe, Home, Navbar, NewHome, Projects};
@ -53,6 +54,8 @@ pub enum Route {
fn PageNotFound(route: Vec<String>) -> Element { fn PageNotFound(route: Vec<String>) -> Element {
rsx! { rsx! {
document::Stylesheet { href: asset!("/assets/styling/notFound.css") } document::Stylesheet { href: asset!("/assets/styling/notFound.css") }
document::Title { "Brock Tomlinson - Not Found" }
set_meta_tags { description: "This is not a valid page", keywords: "404 Nothing" }
div { id: "not-found", div { id: "not-found",
h1 { "Page not found" } h1 { "Page not found" }
p { "We are terribly sorry, but the page you requested doesn't exist." } p { "We are terribly sorry, but the page you requested doesn't exist." }

View File

@ -1,4 +1,4 @@
use crate::Route; use crate::{set_meta_tags, Route};
use dioxus::{logger::tracing, prelude::*}; use dioxus::{logger::tracing, prelude::*};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -93,6 +93,10 @@ pub fn Blogs(page_num: u32) -> Element {
document::Stylesheet { href: asset!("/assets/styling/blog.css") } document::Stylesheet { href: asset!("/assets/styling/blog.css") }
div { id: "blogs", div { id: "blogs",
document::Title { "Brock Tomlinson - Blogs" } document::Title { "Brock Tomlinson - Blogs" }
set_meta_tags {
description: "This is a collection of blog posts, ranging from tutorials, technologies I found interesting, and opinion pieces",
keywords: "blogs blog software engineer webdev",
}
div { id: "blogs-title", div { id: "blogs-title",
h1 { "Blogs" } h1 { "Blogs" }
p { p {

View File

@ -4,7 +4,7 @@ use serde_json;
// use dioxus::logger::tracing; // use dioxus::logger::tracing;
use dioxus::prelude::*; use dioxus::prelude::*;
use crate::views::Contact; use crate::{helper_fun::set_meta_tags, views::Contact};
#[component] #[component]
pub fn ContactMe() -> Element { pub fn ContactMe() -> Element {
@ -17,6 +17,10 @@ pub fn ContactMe() -> Element {
rsx! { rsx! {
document::Stylesheet { href: asset!("/assets/styling/contactme.css") } document::Stylesheet { href: asset!("/assets/styling/contactme.css") }
document::Title { "Brock Tomlinson - Contact" } document::Title { "Brock Tomlinson - Contact" }
set_meta_tags {
description: "Get in Touch, get in contact",
keywords: "contact software engineer webdev",
}
div { id: "ContactMe", div { id: "ContactMe",
div { div {
h2 { "Get in Touch" } h2 { "Get in Touch" }

View File

@ -1,4 +1,5 @@
use crate::components::{Experience, TechCat}; use crate::components::{Experience, TechCat};
use crate::helper_fun::set_meta_tags;
use crate::views::{Contact, Projects}; use crate::views::{Contact, Projects};
use crate::Route; use crate::Route;
use dioxus::prelude::*; use dioxus::prelude::*;
@ -32,6 +33,13 @@ pub fn Home() -> Element {
rsx!( rsx!(
document::Title { "Brock Tomlinson - Home" } document::Title { "Brock Tomlinson - Home" }
document::Stylesheet { href: asset!("/assets/styling/home.css") } 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: "dev webdev Rust rust-lang software engineer",
}
div { div {
div { id: "home-intro", div { id: "home-intro",
h1 { "Hi I'm Brock" } h1 { "Hi I'm Brock" }

View File

@ -1,4 +1,4 @@
use crate::helper_fun::get_tech_logos_from_str; use crate::helper_fun::{get_tech_logos_from_str, set_meta_tags};
use dioxus::prelude::*; use dioxus::prelude::*;
#[component] #[component]
@ -6,6 +6,10 @@ pub fn Projects(#[props(default = true)] independent_page: bool) -> Element {
rsx! { rsx! {
if independent_page { if independent_page {
document::Title { "Brock Tomlinson - Projects" } document::Title { "Brock Tomlinson - Projects" }
set_meta_tags {
description: "Top Featured and Recent Projects",
keywords: "projects Rust CSS HTML JavaScript Dioxus Gitea Git software engineer",
}
} }
div { div {
h2 { "Projects" } h2 { "Projects" }