diff --git a/src/web/routes.rs b/src/web/routes.rs index 2f0e77aa5..a9615f5db 100644 --- a/src/web/routes.rs +++ b/src/web/routes.rs @@ -21,6 +21,10 @@ pub(super) fn build_routes() -> Routes { // https://developers.google.com/search/reference/robots_txt#handling-http-result-codes // https://support.google.com/webmasters/answer/183668?hl=en routes.static_resource("/robots.txt", PermanentRedirect("/-/static/robots.txt")); + routes.static_resource( + "/googleb54494ba4d52c200.html", + super::sitemap::google_search_console_handler, + ); routes.static_resource("/favicon.ico", PermanentRedirect("/-/static/favicon.ico")); routes.internal_page("/sitemap.xml", super::sitemap::sitemapindex_handler); routes.internal_page( diff --git a/src/web/sitemap.rs b/src/web/sitemap.rs index 8bcc93467..6f051d3b9 100644 --- a/src/web/sitemap.rs +++ b/src/web/sitemap.rs @@ -148,6 +148,16 @@ pub fn about_handler(req: &mut Request) -> IronResult { .into_response(req) } +// This authenticates @jsha (https://github.com/jsha) to use the Google Search Console +// https://support.google.com/webmasters/answer/9128668?visit_id=637926083810327397-791277710&rd=2 +// for docs.rs. Removing this handler will de-authenticate. Additional handlers can be +// added for additional users. +pub fn google_search_console_handler(_req: &mut Request) -> IronResult { + Ok(Response::with( + "google-site-verification: googleb54494ba4d52c200.html".to_string(), + )) +} + #[cfg(test)] mod tests { use crate::test::{assert_success, wrapper};