From 284d8b51303136ab25325dc8da7f205b83ac763b Mon Sep 17 00:00:00 2001 From: Daniel Boros Date: Sat, 21 Dec 2024 10:26:49 +0100 Subject: [PATCH] feat: update sitemap.xml --- src/pages/hireus.rs | 1 - src/ssr/server_utils.rs | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pages/hireus.rs b/src/pages/hireus.rs index 13bc046..0f888f9 100644 --- a/src/pages/hireus.rs +++ b/src/pages/hireus.rs @@ -1,4 +1,3 @@ -use std::time::Duration; use leptos::prelude::*; use crate::ssr::api::{hire_us, HireUsRequest}; diff --git a/src/ssr/server_utils.rs b/src/ssr/server_utils.rs index a592475..dfdb970 100644 --- a/src/ssr/server_utils.rs +++ b/src/ssr/server_utils.rs @@ -310,12 +310,31 @@ pub async fn sitemap_handler(State(state): State) -> Response let mut sitemap = String::new(); sitemap.push_str("\n"); sitemap.push_str("\n"); + + let static_urls = vec![ + ("https://rust-dd.com/", "daily", "0.9"), + ("https://rust-dd.com/hireus", "weekly", "1.0"), + ("https://rust-dd.com/references", "weekly", "0.6"), + ("https://rust-dd.com/rss.xml", "daily", "0.5"), + ("https://rust-dd.com/sitemap.xml", "monthly", "0.5"), + ]; + + for (url, freq, priority) in static_urls { + sitemap.push_str("\n"); + sitemap.push_str(&format!("{}\n", url)); + sitemap.push_str(&format!("{}\n", freq)); + sitemap.push_str(&format!("{}\n", priority)); + sitemap.push_str("\n"); + } + for post in posts { sitemap.push_str("\n"); sitemap.push_str(&format!( "https://rust-dd.com/post/{}\n", post.slug.unwrap() )); + sitemap.push_str("monthly\n"); + sitemap.push_str("1.0\n"); sitemap.push_str(&format!("{}\n", post.created_at)); sitemap.push_str("\n"); }