MCPcopy Create free account
hub / github.com/PerroEngine/Perro / og_text

Function og_text

perro_website/src/main.rs:87–190  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

85}
86
87#[cfg(feature = "ssr")]
88async fn robots_txt(headers: axum::http::HeaderMap) -> impl axum::response::IntoResponse {
89 let base = public_base_url(&headers);
90 (
91 [(
92 axum::http::header::CONTENT_TYPE,
93 "text/plain; charset=utf-8",
94 )],
95 format!("User-agent: *\nAllow: /\nSitemap: {base}/sitemap.xml\n"),
96 )
97}
98
99#[cfg(feature = "ssr")]
100fn og_text(path: &str) -> (String, String, String) {
101 let route = path.replace("__", "/");
102 let route = if route == "home" { "" } else { route.as_str() };
103
104 if let Some(slug) = route.strip_prefix("docs/") {
105 if let Some(doc) = perro_website_lib::docs::find_doc("docs", slug) {
106 let summary = if doc.summary.is_empty() {
107 format!("Perro {} docs", doc.area)
108 } else {
109 doc.summary.clone()
110 };
111 return (doc.title.clone(), format!("Docs / {}", doc.area), summary);
112 }
113 }
114 if let Some(slug) = route.strip_prefix("book/") {
115 if let Some(doc) = perro_website_lib::docs::find_doc("book", slug) {
116 let summary = if doc.summary.is_empty() {
117 "Perro book chapter".to_string()
118 } else {
119 doc.summary.clone()
120 };
121 return (doc.title.clone(), "Book".to_string(), summary);
122 }
123 }
124
125 match route {
126 "" => (
127 "Rust Game Engine".to_string(),
128 "Perro Engine".to_string(),
129 "Open-source Rust engine for docs, nodes, examples, and WASM demos.".to_string(),
130 ),
131 "book" => (
132 "Perro Book".to_string(),
133 "Book".to_string(),
134 "Guided install-to-release path for Perro docs, nodes, examples, and demos."
135 .to_string(),
136 ),
137 "nodes" => (
138 "Scene Node Registry".to_string(),
139 "Nodes".to_string(),
140 "Search 2D, 3D, UI, physics, audio, animation, camera, and light nodes.".to_string(),
141 ),
142 "examples" => (
143 "Examples and Demos".to_string(),
144 "Examples".to_string(),

Callers 1

og_imageFunction · 0.85

Calls 4

find_docFunction · 0.85
cloneMethod · 0.80
as_strMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected